in reply to pull - a command line pipe-line building aid to pull perl regexps out of piped input

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+)/"

  • Comment on Re: pull - a command line pipe-line building aid to pull perl regexps out of piped input
  • Select or Download Code

Replies are listed 'Best First'.
Re: Re: pull - a command line pipe-line building aid to pull perl regexps out of piped input
by cider (Acolyte) on Sep 27, 2001 at 08:56 UTC
    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.