Originally Posted by r_clark2
I have to write a single sed script that will remove items in a text file that was assigned to work with. The issue that I have is I have to delete just the salaries in a line that end with 500, the salaries are at the end of the lines and again I just need to delete the salaries that end in 500. Please help!
I have attempted several scripts already and I have yet to get it to work, such as /...500$// /...500$d/
I agree that this looks like homework, but you do mention some sort of a solution at the end.
With sed you can search for a certain pattern and perform an action if that pattern is found. The solution you played with (/...500$d/) is close but syntactically incorrect.
You first tell sed what you are looking for, 500 at the end of a line: /500$/
. Then you tell sed what you want to do, in this case you want to delete the line, which is done by the d
option. Putting both together will give you this: /500$/d
Here's a link to a good sed tutorial: Sed - An Introduction and Tutorial
This explains the delete option: Sed - Delete with d