Why does grep (or tcgrep) "not do that easily"? Ah, that it prints only the match, not the whole line? If tcgrep doesn't already do that, I think you'd be well served to add that feature to tcgrep!
This can be done right from the Perl -e command line using the -n flag. example:
pull '^(\w+)' is simply perl -ne 'print "$1\n" if /^(\w+)/"
| [reply] [d/l] [select] |
I'm quite proud of the ability to do it from a single usable command in a english resembling namespace. Others of its nature off the top of my head which I find useful when hacking at text manipulation and quick pipeline building is:
"before", # pipe, print all text on line before given regexp
"after", # pipe, print all text on line plus str after given regexp
"and", # pipe, print all text and append string after line
"between", # pipe, print text between regexp1 and regexp2
"match", # pipe, print any line matching regexp
"exclude", # pipe, print any line not matching regexp
"matchand", # pipe, print any line matching regexp w/and
"matchbefore", # pipe, print any line matching regexp w/before
all of which are available here.
| [reply] |