How to get the line no. which have the max words...?
Please help me to get the solution for the scenario:
e.g. File :a.txt
One Two Three
1. How to get the line no. which have the max words in it ..?
The command should print(for above a.txt) : 3
2. How I can print the particular line in a file..?
E.g. If suppose I want to print the 3rd line
3. How to print the line no and word and character count for the every line present in the file?
Line No. 1 Word : 1 Char Count: 3
Please help me ...
Also suggest me the best tutorial for the similar shell programs and commands..
Thanks in advance
You can use the wc command to get number of lines, number of words and number of characters. (Type "man wc" for more details.)
You can use the grep command to get lines with specific information and also print the line number for the lines it finds. (Type "man grep" for more details.)
You can use awk to do a lot of this as well. Use of awk can become fairly sophisticated. Searching for specific usage cases in web searchers for what you want to do would be good even after you've gone through an awk tutorial. For most Linux subjects if you type the subject and tutorial in a web search you'll find many hits. (e.g. "awk tutorial"). Of course awk also has a man page (man awk).
Linux also has info pages that sometimes give more detail than the man pages.
|All times are GMT -5. The time now is 03:49 PM.|