Thread: Sed and pattern matching.
09-25-2006, 04:06 PM #1New Member
- Join Date
- Sep 2006
Sed and pattern matching.
Hi I wish to alternately change some of the data in the following way. For example I wish to switch all species from their current value to their binary opposite. I.e. from 1 -> 0 and from 0 -> 1 when the LIPID number is even. Now the data is on the file such that the LIPID number is before the SPECIES number. Therefore I came up with the following sed script to attempt to do this. However this script doesńt work when there is information/data between the LIPID and the SPECIES but seems to work just fine otherwise. Here is the script and the data file:
s/SPECIES 1/SPECIES 0/
}' Test1.txt > OP.txt;
mv OP.txt Test1.txt;