Command erase lines
How could I get rid of the lines in a file that contain a specific word ?
for instance directory: /home/stuff: directory /home/other: data /home/down: empty Cheers |
Use the -v option to grep. Suppose you have a file called "pizza.toppings" containing a list of (what else?) pizza toppings, and you want to remove 'sausage' from the file, you just need to:
Code:
grep -v sausage pizza.toppings > pizza.toppings.without.sausage |
Thanks a lot Matir for the vegetarian pizza :D that's exactly what I needed!
I was trying something else but your method is much better Code:
sed '/directory/d' list_file > new_file Cheers :) |
sed would work as well, but I think grep is just a much more direct way to do things. :)
And can you tell how ready I am to go to lunch? |
Enjoy your lunch Matir :p ! here it's more time for diner
Thanks again for helping |
All times are GMT -5. The time now is 02:37 PM. |