
Acabo de leer en un libro que el comando head -LINES
muestra las primeras LÍNEAS de un archivo. Sin embargo, head
la página de manual de no parece revelar que este sea un argumento legítimo. Me gustaría saber lo que me falta.
NOTA: Lo mismo parece ser cierto para tail
la página de manual de.
Respuesta1
No es un argumento estándar; solo un remanente de los primeros sistemas Unix. Para GNU head/tail, puede encontrar más información en info head
:
For compatibility ‘head’ also supports an obsolete option syntax
‘-[NUM][bkm][cqv]’, which is recognized only if it is specified first.
NUM is a decimal number optionally followed by a size letter (‘b’, ‘k’,
‘m’) as in ‘-c’, or ‘l’ to mean count by lines, or other option letters
(‘cqv’). Scripts intended for standard hosts should use ‘-c NUM’ or ‘-n
NUM’ instead. If your script must also run on hosts that support only
the obsolete syntax, it is usually simpler to avoid ‘head’, e.g., by
using ‘sed 5q’ instead of ‘head -5’.
OpenBSD man head
tiene una nota más breve:
The historic syntax -count is supported by this implementation.