-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?

muru
  • 197,895
  • 55
  • 485
  • 740

1 Answers1

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
heemayl
  • 91,753
  • @ManishBharti no problem..consider accepting the solution so that this issue can be marked as solved.. – heemayl Feb 07 '16 at 06:30