Unix / Linux: Read File from Line Number

Objective: Read a file from a specific line number or skip the first x numbers of lines.

To read a file starting from a specific line, the tail command can be used. To read a file from line 5 onwards, use the following syntax.

$ tail -n +5 /path/to/file

The “+5” offset argument to tail tells it to output lines from the 5th line till the last line of the file.

To get the same result using sed, use the following syntax.

$ sed '5,$!d' < /path/to/file

The parameter "5,$" means from line 5 till end of file. The exclamation mark "!" will select all lines that do not match. And finally "d" is to delete the line.

ibrahim = { interested_in(unix, linux, android, open_source, reverse_engineering); coding(c, shell, php, python, java, javascript, nodejs, react, vuejs); plays_on(xbox, ps4); linux_desktop_user(true); }