[Tfug] grep question [was find | grep]

Jeff Breadner jeff at breadner.ca
Thu Oct 23 21:21:38 MST 2008


>
>
> ...ummm, now that all the terms/lines containing '@' are in one file 
> (which is fine in itself), is there any way I could extract the string 
> of characters containing the '@' symbol, but only print those 
> characters in the string between the '=' symbol and the ')' symbol???
>
> and output that into a nice text file with commas in between?????
>
> I suppose I can write my own script someday.
>
> :|
>
> Here's are two sample lines of output:
>
> (145=lasalledre at aol.com)(146=lasalledre)(14D=438f81ad)(147=2f)(A1
> (152=marc diMinno)(142=marcdiminno at hotmail.com)(153=43919ff2)(143=2e
>
> which would be perfect to see like this:
>
> ...
>
> lasalledre at aol.com,
> marcdimminno at hotmail.com,
>
> ...
>
>
Another one, this one might be more reliable for your specific 
situation, but less portable to other files (should anyone else be 
looking for a similar solution).  This one replaces the bracket and 
equals signs with newline characters, then just greps out any line that 
has an @ symbol in it:

cat inputfile | tr \(=\) \\\n\\\n\\\n | grep @


cheers
  Jeff




More information about the tfug mailing list