![]() This is shown below: ~]# wc -w lintut.txtġ6 lintut.txt Print count of bytes, count of characters from a file Just use the -w option to find the count of words in a file. Run the below command to display the number of lines: ~]# wc -l lintut.txtĥ lintut.txt Displaying the number of words. This is the most commonly used operation to find the number of lines from a file. ~]# wc lintut.txtĥ 7 46 lintut.txt Printing count of lines The three numbers shown below are 5 ( number of lines), 7 ( number of words) and 46 ( numberof bytes) of the file. The ‘ wc‘ command without passing any parameter will display a basic result of ” lintut.txt‘ file. ![]() Create the following file in your unix or linux operating system. ![]() Let see how to use the wc command with few examples. ![]() wc -l: print the newline counts wc -w: print the word counts wc -c: print the byte counts wc -m: print the character counts wc -L: print the length of the longest line wc –help: display this help and exit wc –version: output version information and exit The syntax of wc command is shown below: # wc filenames You can use the following options with the wc command. WC command in unix or linux is used to find the number of lines, words and characters in a file. In this article, we will discuss 5 basic examples of this command. The Linux wc command is a useful command that can come in handy if you ever want to know details like newline counts, byte counts, character counts etc for a file which is supplied as input.
0 Comments
Leave a Reply. |