Which command will print line numbers before each line in a file?
A.
ln
B.
nl
C.
cat -n
D.
numline
Which command will print line numbers before each line in a file?
Which command will print line numbers before each line in a file?
A.
ln
B.
nl
C.
cat -n
D.
numline
But cat -n also print line numbers before each line ?
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.
It says ‘each line’, so I think cat -n is the correct answer. nl does not number empty lines.
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.
nl – number lines of files