[Tfug] grep question [was find | grep]
Jeff Breadner
jeff at breadner.ca
Thu Oct 23 21:17:39 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,
>
> ...
I tried writing this in sed, but I'm far from being a sed master, and
couldn't get it going.
This is rough, but should mostly work:
cat inputfile | grep -o "[A-Za-z0-9._%+-]*@[A-Za-z0-9.-]*\.[A-Za-z]*"
On your sample input file this returns:
lasalledre at aol.com
marcdiminno at hotmail.com
cheers
Jeff
More information about the tfug
mailing list