What are you trying to do? sed and awk are two different programs but work very well together. sed is an inline editor and awk is pattern scanning language. Both have overlapping features.
If you want to replace something in a file, you can:
cat $fname | sed s/old_pattern/new_pattern/ > $new_fname
ie.
cat test.txt | sed s/"Robert Smith"/"Bob Smith"/ > newtest.txt
and that would replace every occurance of Robert Smith with Bob Smith
Note: the search criteria, Robert Smith, is case sensitive.
For more complex things like tables and strict formatting, you might be better off with awk. The Oreilly sed & awk book, Second Edition is a great reference.
|