Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re^2: Counting the Extensions of the Directory

by Mago (Parson)
on Dec 14, 2005 at 12:48 UTC ( #516605=note: print w/replies, xml ) Need Help??

in reply to Re: Counting the Extensions of the Directory
in thread Counting the Extensions of the Directory

You are not counting the extensions ?

IBIZA desentol /tarifa1/users/desentol/mlima/dados/input > ls | grep - +oE "\.\w+$" | sort -u grep: illegal option -- o usage: grep [-E | -F] [-c|-l|-q] [-insvxbhwy] [-p parasep] -e pattern_ +list... [-f pattern_file...] [file...] usage: grep [-E | -F] [-c|-l|-q] [-insvxbhwy] [-p parasep] [-e pattern +_list...] -f pattern_file... [file...] usage: grep [-E | -F] [-c|-l|-q] [-insvxbhwy] [-p parasep] pattern [fi +le...]


Replies are listed 'Best First'.
Re^3: Counting the Extensions of the Directory
by EdwardG (Vicar) on Dec 14, 2005 at 12:59 UTC

    GNU grep 2.5.1 has the -o option to output only the matched text. Your grep doesn't.

    As for counting...

    E:\tmp>ls | grep -oE "\.\w+$" | sort -u | wc -l 12



      You are counting to everything and not each extension !?

      IBIZA >ls SN10738.ksh calculo_SN10738.ksh separa_tabllama.awk SN10738.log calculo_SN10738B.ksh transferSN10738A.ksh filtroSN10738A.ksh separaVielinSN10406.ksh IBIZA >perl -e 'while(<*>){if(-f && /\.(\w+)$/){$e{$1}++}}print "$_ -> + $e{$_}\n" for keys %e' ksh -> 6 awk -> 1 log -> 1
      SHELL: IBIZA >ls | cut -sf2 -d. | sort | uniq -c 6 ksh 1 awk 1 log


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://516605]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (10)
As of 2016-10-25 16:58 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (326 votes). Check out past polls.