Pages

Sunday, January 3, 2016

wc command one liners

Home

Normal Use of wc command

# wc /etc/passwd
  23   30 1035 /etc/passwd

To count number of lines in a file

# wc -l /etc/passwd
23 /etc/passwd

To count number of words in a file

# wc -w /etc/passwd
30 /etc/passwd

To count number of characters in a file

# wc -c /etc/passwd
1035 /etc/passwd

To apply normal wc command on a output using PIPE operator

# cat /etc/passwd |wc
     23      30    1035

To count number of lines from an output using PIPE

# cat /etc/passwd |wc -l
23

To count number of words from an output using PIPE

# cat /etc/passwd |wc -w
30

To count number of characters form an output using PIPE

# cat /etc/passwd |wc -c

1035

Back To Top
Home

No comments:

Post a Comment