View Single Post
Old 06-08-2012, 01:51 AM   #26
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Here is a solution for the above post coming straight from a Linux forum.
I have been told that problem was that grep was reading on stdin (for whatever it means...)

Spoiler:

Code:
pcregrep -o -h 'class=".+?"' * >fic_tmp.$$
for i in $(sort -u fic_tmp.$$); do echo "$i $(grep -rc $i fic_tmp.$$)"; done | sort -t ' ' -k2 -nr
Tried on one EPUB of mine.

Code:
roger@lmde64 ~/Bureau/Coups/OEBPS/Text $ pcregrep -o -h 'class=".+?"' * >fic_tmp.$$
roger@lmde64 ~/Bureau/Coups/OEBPS/Text $ for i in $(sort -u fic_tmp.$$); do echo "$i $(grep -rc $i fic_tmp.$$)"; done | sort -t ' ' -k2 -nr
class="smcpIncise" 225
class="smcpCentrage" 57
class="Header" 54
class="let" 35
class="let2" 35
class="let1" 35
class="Standard" 28
class="Centrage" 24
class="smcpTypeA" 17
class="smcpTypeV" 16
class="smcpDroite" 16
class="Subtitle" 5
class="Italdroite" 5
class="Heading" 2
class="smcpChanson" 1
class="frameFrame" 1
class="Chanson" 1
roger@lmde64 ~/Bureau/Coups/OEBPS/Text $

The result provides needed information (classes only).

Last edited by roger64; 06-08-2012 at 01:59 AM.
roger64 is offline   Reply With Quote