View Single Post
Old Jun 17th, 2005, 12:52 PM   #1
Ken2
Newbie
 
Join Date: Jun 2005
Posts: 2
Rep Power: 0 Ken2 is on a distinguished road
Sed, insert string to the beginning of a line

Hello,
I would need to add a specific string to the beginning of every line in a document which contains an other specific string, by using Sed or Awk.
I've tried my best to figure out this myself by using examples and tutorials, but I cant find any documentation about this. I did find out how to add something to the beginning of every line (s/^.*/text-to-add/ ), but I didn't manage to convert that so that it would work as i need it.

Ie. If a line contains the string <AB>, i would like to add a the text 'CDE' to the very beginning of that same line.

Im using Sed for Windows, but I asume the commands are almost the same as for Linux.

Thank you in advance,
Ken2

Last edited by Ken2; Jun 17th, 2005 at 3:20 PM.
Ken2 is offline   Reply With Quote