(Video materials in preparation)
ctail : Delete the last n rows of a file
Usage : ctail [-n] [-]<n>[c] <file>.
Version : Tue Jan 9 09:02:34 JST 2024
Edition : 1
Outputs the file specified as the argument or standard input
removing the last <n> lines.
If specified as -<n>c then the last <n> bytes are removed.
The "-n" argument can be omitted.
ctail -n 3
ctail -3
ctail 3
all behave identically.
Remove the last 3 lines.
$ cat data
001 Maine
002 Vermont
003 New_York
004 Delaware
005 Georgia
006 Delaware
007 Mississippi
008 Alabama
009 Hawaii
$ ctail -3 data
001 Maine
002 Vermont
003 New_York
004 Delaware
005 Georgia
006 Delaware
# Remove last 11 characters ("009 Hawaii<NL>")
$ ctail -11c data
001 Maine
002 Vermont
003 New_York
004 Delaware
005 Georgia
006 Delaware
007 Mississippi
008 Alabama