Prepend Text To Start Of Every Line By leerb on November 12, 2013 in Misc Prepend the text “foo” to the start of every line in file. With sed: sed -i.bak 's/^/foo/' file 1 sed -i.bak 's/^/foo/' file With perl: perl -e 'while (<>) {print "foo"}' < infile > outfile 1 perl -e 'while (<>) {print "foo"}' < infile > outfile Taken from: Prepend ## to every line in a text file Related posts: Encode/decode SMTP AUTH username/passwords Here Doc Nameserver check script Zimbra Mailbox Size Find group writable home directories