sed replacing a specific character with a specific number
i want to change all the "B's" in a text file to be replaced witha specific number such as"1" but in the same text i would like to replace all the "C's" with "2" and "D's" with 3
Code:
sed 's/b/1/g' $fl.old > $fl |
Hi,
Untested, but this should work: sed -i.bak -e 's/b/1/g' -e 's/c/2/g' -e 's/d/3/g' infile With the -e option you can string together multiple sed statements. The -i.bak makes in file changes and saves the original with an added .bak. Hope this helps. |
1. You can combine the three commands:
Code:
sed -e 's/b/1/g' -e 's/c/2/g' -e 's/d/3/g' fl.old > fl |
All times are GMT -5. The time now is 09:28 PM. |