-4

I am bit confuse about the command

cat filename.txt -b 

and

cat filename.txt -n

They show the same output to the screen .Then what is the difference between them?

1
  • 1
    Manual pages are your friends, in terminal you can do 'man cat' to view explanation of each option Feb 7, 2016 at 6:54

1 Answer 1

3

In cat, -b shows the line numbers of non-empty lines, whereas -n shows the line numbers of all lines regardless of emptiness.

Example:

% cat -n file.txt 
     1  foo
     2  
     3  bar

% cat -b file.txt
     1  foo

     2  bar

Also note that -b overrides -n when used together:

% cat -bn file.txt
     1  foo

     2  bar
1
  • @ManishBharti no problem..consider accepting the solution so that this issue can be marked as solved..
    – heemayl
    Feb 7, 2016 at 6:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .