Can I use cat -n with multiple files?

0127

Yes, you can use cat -n with multiple files. When you specify multiple files, cat -n will number the lines across all the files sequentially.

Here’s an example:

cat -n file1.txt file2.txt

If file1.txt contains:

Line 1
Line 2

And file2.txt contains:

Line A
Line B

The output will be:

     1  Line 1
     2  Line 2
     3  Line A
     4  Line B

This way, the line numbers continue from the first file to the second file.

0 Comments

no data
Be the first to share your comment!