Script help using "cut"

Giorgos Keramidas keramida at ceid.upatras.gr
Wed Aug 24 01:16:42 GMT 2005


On 2005-08-23 20:02, antenneX <antennex at swbell.net> wrote:
> Been trying to complete a script that I can use to grep spam emails
> from the maillog, then trim it to just the plain email address. Trying
> to use "cut" in the script but it's not doing what I want yet.
>
> Here is what the earlier lines have the lines down to so far:
> "        (envelope-from spammer at badguy.com)"  -- no quotes
> ...and I want this "clean" trimmed result after trim using "cut" or
> anything else that works to trim/cut:
>
> spammer at badguy.com  <--- no underlines of course
>
> That's a TAB space at beginning of the line.
>
> The "envelope" lines are in a tmp file in colum format (one line below
> the other).
>     (envelope-from spammer at badguy.com)
>     (envelope-from spammer2 at badguy2.com)
>     (envelope-from spammer3 at badguy3.com)
>
> All ideas appreciated....

Does it have to be cut(1)?

$ awk '{print $2}' tmpfile | sed -e 's/)[[:space:]]*$//' | sort | uniq



More information about the freebsd-questions mailing list