Deleting a line with gawk/awk
I was wondering how I would delete a line using gawk/awk.
have this command to find the line I want to delete: Code:
gawk '/\/dev\/sda1/ { print }' test1 Thanks in advance. |
Why do you need to use gawk? I just do a grep -v on the regular expression and redirect the ouput wherever you want it to go.
|
Oh, wow that is much easier. Thanks.
(Oh if anyone saw the post that was here for about 1 minute, taht was because I didn't read the right "-v" :) ) |
sed would work too
sed '/searchpattern/d' filename >newfile |
And just so awk doesn't fall aside ...
awk '!/hda1/ {print}' /etc/fstab awk is absolutely awksome! :) Cheers, Tink |
All times are GMT -5. The time now is 09:03 PM. |