How do I print the first line in Unix?
Answer
Yes, that is one way to get the first line of output from a command. There are many other ways to capture the first line too, including sed 1q (quit after first line),
sed -n 1p (only print first line, but read everything), awk ‘FNR == 1’ (only print first line, but again, read everything) etc.
Answer
Yes, that is one way to get the first line of output from a command. There are many other ways to capture the first line too, including sed 1q (quit after first line),
sed -n 1p (only print first line, but read everything), awk ‘FNR == 1’ (only print first line, but again, read everything) etc.