Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 1.31 KB

cat_b.md

File metadata and controls

50 lines (36 loc) · 1.31 KB
layout title tags
manual
cat -b || Clear definition of blank when using option -b of command cat
cat

Scenario

When using a command line interface of mac machine, we use command cat to look inside a file.

Options -b for cat

b is the abbreviation of blank.

Manpage Description

Number the non-blank output lines, starting at 1.

Detail Explain

This option ignores the blank output lines and delivers a neat print out. However, the definition of blank need to be addressed here.

Sometimes, when using option -b, you still see a blank line with a line number at the very beginning. This is because there is still something in the line. It could be a space or a tab. They can't be seen by human but they can be seen by the machines. So it's not completely blank.

Version

Mac (BSD) command line utilities

Examples

Here is the example of cat -b.

  • Let's create a file (file1.sh) for testing option -b.
# the content of file1.sh                                 
1 echo "file1"
2 # completely blank
3     # a tab
4 # completely blank
5     # a tab
6 echo "file1"
  • cat -b Number the non-blank output lines, starting at 1.
$cat -b file1.sh 
     1	echo "file1"

     2		

     3		
     4	echo "file1"