how i can add Add text at the beginning of each line?

for example:- i have file contain:- /var/lib/svn/repos/b1me/products/payone/generic/code/core /var/lib/svn/repos/b1me/products/payone/generic/code/fees /var/lib/svn/repos/b1me/products/payone/generic/code/2ds

i want it to become:-

svn+ssh://svn.xxx.com.jo/var/lib/svn/repos/b1me/products/payone/generic/code/core svn+ssh://svn.xxx.com.jo/var/lib/svn/repos/b1me/products/payone/generic/code/fees svn+ssh://svn.xxx.com.jo/var/lib/svn/repos/b1me/products/payone/generic/code/2ds

in other word i want to add "svn+ssh://svn.xxx.com.jo" at the beginning of each line of this file

link|improve this question

to get this to work you are going to have to add an svn command to the beginning of each line too e.g. svn list svn+ssh://svn.xx.com.jo/var ... – Iain Sep 22 '10 at 9:57
feedback

2 Answers

up vote 1 down vote accepted

If your text is a file named "file.txt" you use this command line

awk '{print "svn+ssh://svn.xxx.com.jo" $1}' file.txt

It will output what you want. (assuming that no path contain a space)

link|improve this answer
feedback

Using sed:

sed 's|^|svn+ssh://svn.xxx.com.jo|' filename

To change the file in place:

sed -i 's|^|svn+ssh://svn.xxx.com.jo|' filename
link|improve this answer
i execute it but the following error apear.....command garbled: – Mohammad AL-Rawabdeh Sep 22 '10 at 7:31
Your version of sed may need -e: sed -e 's|^|svn+ssh://svn.xxx.com.jo|' filename – Dennis Williamson Sep 22 '10 at 10:10
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.