Adding/Replacing lines with SED
Posted on 2007-10-09
Having trouble with getting SED to do what I want it to. The Win32 port seems to work a little differently then the linux version.
Here is the sample data:
I need to change the first instance of "CHECK=Y" to "CHECK=N" and then add a line underneath that adds "IDText=Y".
This swaps the text properly, but it does it for all instances in a file, not just the first one.
sed "s/Check=Y/Check=N/" danic.ini > danic2.ini
And I can't seem to figure out the proper command to add a line after it finds the first instance of a string.
Any help would be appreciated.