-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
| Short | Long | Value | Default | Meaning |
|---|---|---|---|---|
-n | --lines | [-]NUM | print the first NUM lines instead of the first 10; with a leading '-', print all but the last NUM lines of each file |
Examples
Print the first 3 lines of each file, with headers
headx -n 3 a.txt b.txtPrint only the header row of a CSV file
headx -n 1 data.csvPrint the first line of every CSV file without the file name headers
headx -q -n 1 *.csvShow the file name header even for a single file (--silent is the long spelling of -q)
headx -v -n 2 config.iniPrint everything except the last 2 lines
headx -n -2 report.txtPrint lines 11 to 20 of a file
headx -n 20 app.log | tailx -n 10Cut an endless stream down to three lines
yesx ok | headx -n 3Take the first two entries of a NUL-separated list
find . -name '*.txt' -print0 | headx -z -n 2 | xargs -0 wcx -lFail a script when a file cannot be read
headx -n 1 missing.txt || echox "exit status $?"Help in the terminal
gnux help headx --lines