Which command will print line numbers before each line in a file?
A. ln
B. nl
C. cat -n
D. numline
5 Comments on “Which command will print line numbers before each line in a file?”
sarasays:
But cat -n also print line numbers before each line ?
1
0
Simonsays:
To me they are both correct but the question does not make it clear if its every line or just the lines that are populated.
0
0
RJNsays:
It says ‘each line’, so I think cat -n is the correct answer. nl does not number empty lines.
0
0
sarasays:
hmm.. I got it. Question is “Which command ..” , and in fact nl command do this not cat command. cat just with -n option give same result. That’s why B is correct.
But cat -n also print line numbers before each line ?
1
0
To me they are both correct but the question does not make it clear if its every line or just the lines that are populated.
0
0
It says ‘each line’, so I think cat -n is the correct answer. nl does not number empty lines.
0
0
hmm.. I got it. Question is “Which command ..” , and in fact nl command do this not cat command. cat just with -n option give same result. That’s why B is correct.
0
0
nl – number lines of files
0
0