tmonteit
asked on
Need Unix Command Help finding unique values.
I need to redo my style sheets for 150 jsp files
I want to find all the unique classes among my jsp files.
find . -name "*.jsp" -print | xargs grep "class=" | wc -l
produces 4000+ results
My guess is that there are only about 200 unique terms in the quotes after class="className".
For example if this was my results, there are only 3 unique classes.
<td class="columnValue">
<td class="myOtherClass">
<td class="aThirdClass">
<td class="aThirdClass">
How do I build a unix command to only show me the unique class="className" where className is unique?
I want to find all the unique classes among my jsp files.
find . -name "*.jsp" -print | xargs grep "class=" | wc -l
produces 4000+ results
My guess is that there are only about 200 unique terms in the quotes after class="className".
For example if this was my results, there are only 3 unique classes.
<td class="columnValue">
<td class="myOtherClass">
<td class="aThirdClass">
<td class="aThirdClass">
How do I build a unix command to only show me the unique class="className" where className is unique?
perl -MFile::Find -le '$/="class=";find(sub{retu rn unless /\.jsp$/;@ARGV=($_);/^"(.* ?)"/&&$s{$ 1}++while< >},"."); print for sort keys %s'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks ozo. I forgot the .* at the beginning