sed remove last 3 lines 1

sed remove last 3 lines

head -n -1 file.txt	#Use negative numbers after flag for last lines

Here is what the above code is Doing:
1. The -n flag tells the head command to print the first n lines of the file.
2. The -1 flag tells the head command to print the first line of the file.
3. The -n flag tells the tail command to print the last n lines of the file.
4. The -1 flag tells the tail command to print the last line of the file.

Similar Posts