http://qs321.pair.com?node_id=1037596


in reply to Count Quoted Words

If you just want the count of all white space words within double quotes in a text file, you don't need to keep much information hanging around. Try filtering:

perl -E 'say 0+map{split}grep{$i++%2}split/"/,do{undef$/;<>};' fil.txt

(Please pardon the golfing, I have this thing about keeping one-liners on one line ;-)