Skip to Content
gnux

-n, --lines

Print the first NUM lines instead of the first 10; with a leading '-', print all but the last NUM lines of each file.

An option of headx.

Usage

headx -n [-]NUM [FILE]...
headx --lines=[-]NUM [FILE]...

Details

ShortLongValueDefaultMeaning
-n--lines[-]NUMprint the first NUM lines instead of the first 10; with a leading '-', print all but the last NUM lines of each file

Examples

headx -n 3 a.txt b.txt
headx -n 1 data.csv
headx -q -n 1 *.csv

Show the file name header even for a single file (--silent is the long spelling of -q)

headx -v -n 2 config.ini
headx -n -2 report.txt
headx -n 20 app.log | tailx -n 10

Cut an endless stream down to three lines

yesx ok | headx -n 3

Take the first two entries of a NUL-separated list

find . -name '*.txt' -print0 | headx -z -n 2 | xargs -0 wcx -l

Fail a script when a file cannot be read

headx -n 1 missing.txt || echox "exit status $?"

Help in the terminal

gnux help headx --lines

On this page