How do I find and many words of a file with the Linux shell?
I have
text
example
text
example
text
example
text
example
And I need
text
example1
text
Example2
text
example3
text
example4
That is, the word is located and then numbers.
|
How do I find and many words of a file with the Linux shell? I have
And I need
That is, the word is located and then numbers. |
||||
|
I don't completely understand your question. However provided your input example and your output example you can do something like this (just an orientation): Your input file named "example" is as follows:
So provided that "text" can be any thing in a line, and "example" is just "example" (edit my code to fit your needs); you can match your output requirements with the following statement (not too much exhaustive however):
HTH |
|||
|
|
|
What you say and what you demonstrate seem to contradict each other. If you truly want to count the number of words in a file, you can use
|
|||
|
|
|
As I understand from example you want to print lines and after that line number. For printing line number and then lines you can use
But there is no possibility to print numbers after lines in
|
|||
|
|
textandexample*where on two different line, shown on a single line because of poor use of markdown. – enzotib Sep 17 '11 at 7:51