Theodoros Emmanouilidis

Notes & Thoughts

awk Script That Adds Specified Prefix To Each Line

February10

This is a useful awk script that adds specified prefix to each line of a given text file.

1
awk -v PRE='THE_PREFIX_THAT_YOU_WANT' '{$0=PRE$0; print}' my_input_file.txt > my_output_file.txt

It’ s so simple with awk!

posted under Tip Of The Day | Comments Off on awk Script That Adds Specified Prefix To Each Line