Cai, Lucy (L.) wrote:
> Hi, all,
>
> I have a question about regular expression:
>
> my code is like this:
> **
> sub IsPVob
> {
> my ($Vob) = @_;
>
> my $Output = `cleartool lsvob $Vob`;
> die "IsPVob
Title: Counting words
Hi, all,
I have a question about regular
_expression_:
my code is like this:
**
sub
IsPVob{ my ($Vob) =
@_;
my $Output =
`cleartool lsvob $Vob`; die
"IsPVob can't list vob $
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
Title: Counting words
Craig,
A fairly simple way to do this would be to open the file
and step though it tracking the first words like this:
open FH, "the_file.txt";
foreach $line () {
# non-greed pattern match to get the
first word on the line ($first_word) =
$line =~ /^(\S+?)\s
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