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

command-line-interfacefileslinux

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

Best Answer

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)

Related Topic