I would write it as:
perl -lne '$s += /^\w+\047?\w+\s+\w+\047?\w+\s/ }{ print $s' file.txt
Update: After re-reading the original post again that should be:
perl -lne '$s += /^\w+(?:\047\w+)?\s+\w+(?:\047\w+)?/\s/ }{ print $s' +file.txt
In reply to Re^3: syntax error near unexpected token `)'
by jwkrahn
in thread syntax error near unexpected token `)'
by vit
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |