CSCI 344
Sample Sed Problems
Lab 2
Write a sed scripts to do each of the following:
- Delete leading whitespace from the front of each line
- Delete trailing whitespace from end of each line
- Insert 5 blank spaces at the beginning of each line
- Substitute "foo" with "bar" ONLY on lines which contain "baz"
- Substitute "foo" with "bar" EXCEPT for lines which contain "baz"
- change "scarlet" or "ruby" or "puce" to "red"
- print first 10 lines of file
- print only line which match a regular expression
- pirnt all of file EXCEPT section between 2 regular expressions
- delete the first 10 lines of a file