Given a text file of unknown length, how can I read, for example all but the first 2 lines of the file? I know tail will give me the last N lines, but
tail
using awk to get all but the last 2 line
awk 'FNR==NR{n=FNR}FNR<=n-3{print}' file file
awk to get all but the first 2 lines
awk 'NR>2' file
OR you can use more
more +2 file
or just bash
#!/bin/bash i=0 while read -r line do [[ $i > 1 ]] && echo "$line" ((i++)) done <"file"