Which command will print line numbers before each line in a file?

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

Explanation:
cat -n prints a line number in front of EVERY line of the file, where nl does not number the empty lines.
In my opinion both B and C would be correct



Leave a Reply 4

Your email address will not be published. Required fields are marked *


Ross Greylock

Ross Greylock

The question says “each line”… wouldn’t that mean empty line or not?

I like cat -n

networkmanagers

networkmanagers

“each line” is not mean “empty line “

Gray

Gray

Actually, I do know some place put answer to be cat -n. Cause it is more reasonable for “each line”

sara

sara

Question is “Which command …” and in fact cat command does not print numbers before each line , but nl does . cat with -n option give desired result.