Artificial intelligent assistant

How do I delete the first n lines of an ascii file using shell commands? I have multiple files that contain ascii text information in the first 5-10 lines, followed by well-tabulated matrix information. In a shell script, I want to remove these first few lines of text so that I can use the pure matrix information in another program. How can I use bash shell commands to do this? If it's any help, I'm using RedHat and an Ubuntu linux systems.

As long as the file is not a symlink or hardlink, you can use sed, tail, or awk. Example below.


$ cat t.txt
12
34
56
78
90


## sed


$ sed -e '1,3d' < t.txt
78
90


You can also use sed in-place without a temp file: `sed -i -e 1,3d yourfile`. This won't echo anything, it will just modify the file in-place. If you don't need to pipe the result to another command, this is easier.

## tail


$ tail -n +4 t.txt
78
90


## awk


$ awk 'NR > 3 { print }' < t.txt
78
90

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy ef5ae52659b55a103d6e6a8e56b83599