A ‘sed’ command comes to rescue here, when we need to delete certain lines of a file.
Here it the exact command to remove headers from a file (or first line of a file).
# sed '1 d' file.txt
The only problem with above command is that, it outputs the file on standard output without the first line. In order to save the output to file, we need to use redirect operator which will redirects the output to a file.
# sed '1 d' file.txt > new_file.txt
Well the built in switch ‘-i‘ for sed command, can perform this operation without a redirect operator.
# sed -i '1 d' file.txt