I would like to delete the lines from text files if $4 is one
123 34 A 0
23 45 A 1
36 5 A 36
176 3 A 1
desired output
123 34 A 0
36 5 A 36
I need in-place editing. How can I do this with awk or sed?
One way using GNU sed with -i for in-place editing and -r for extended regular expressions:
sed -ri '/^\S+\s+\S+\s+\S+\s+1( |$)/d' file
If you desperately need in-place editing, you may also like to try perl with it's auto-split functionality. The code is much more readable and portable too:
perl -i -ane 'print if $F[3] != 1' file
Results:
123 34 A 0
36 5 A 36