Reputation: 55
I want to create an script that deletes few lines from a file containing the following text
you.com
me.ac.id
burger.co.us
manheal.com
If i want to delete this:
burger.co.us
How is the syntax in shell programming??
Upvotes: 2
Views: 21684
Reputation: 272277
sed "/burger.co.us/d" < inputfile > outputfile
will match and delete that line from inputfile
and write to outputfile
using redirection.
Note that you can't read your input and write to the same file using the above. Instead use the -i
field to specify replacement in-place.
See here for more about sed.
Upvotes: 13