If it doesn't have to be perl: cat t.txt | awk '{ print $1 }' | sort |
uniq -c
Sharp, Craig wrote:
I have a file that contains many li˜es. Here is an example:
evaluate eaprod 7844 2 15688 0 2
evaluate agncyis 7347 2 14694 0 1
agncyis compstr 1117 2 0 0 0
evaluate highcost 7036 4 28144 0 0
eval
TED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Sharp, CraigSent: Wednesday, April 26, 2006 7:44 AMTo:
perl-unix-users@listserv.ActiveState.comSubject: [Perl-unix-users]
Counting words
I have a file that contains many li˜es. Here is an
example:evaluate eaprod
7844
2
I need to loop through and find the first word in each line and count
the number of lines that contain this word in the first position.
How about this:
$ cat file-with-words | cut -d" " -f1 | sort | uniq -c
-Aleksandar
___
Perl-Unix-Users ma
On 4/26/06, Sharp, Craig <[EMAIL PROTECTED]> wrote:
I have a file that contains many li˜es. Here is an example:
evaluate eaprod
7844
2 15688
0
2
...
opncon
auditrec
8842
1
8842
0
1
I need to loo
Sharp, Craig wrote:
> I have a file that contains many li˜es. Here is an example:
>
> evaluate eaprod 7844 2 15688 0
> 2
> evaluate agncyis 7347 2 14694 0
> 1
> agncyis compstr 1117
Title: Counting words
I have a file that contains many li˜es. Here is an example:
evaluate eaprod 7844 2 15688 0 2
evaluate agncyis 7347 2 14694 0 1
agncyis compstr 1117 2