Awk command to print all the lines except the last three lines
- by Avinash Raj
I want to print all the lines except the last three lines from the input through awk only. Please note that my file contains n number of lines.
For example,
file.txt contains,
foo
bar
foobar
barfoo
last
line
I want the output to be,
foo
bar
foobar
I know it could be possible through the combination of tac and sed or tac and awk
$ tac file…