On 12/19/2017, at 11:14, Christopher Stone <[email protected] 
<mailto:[email protected]>> wrote:
> Okay, let's do something similar with sed by assembling the command and then 
> running it.


Hey Rick,

This one will automatically remove all empty lines — and it will sort the list 
and ensure each email address is unique (i.e. no duplicates).

It would be easy enough to make this work from a file instead of embedded 
invalid email addresses.

--
Take Care,
Chris


#!/usr/bin/env bash

# Enter invalid email addresses here — one per line.
read -r -d '' emailAddressList <<'EOF'

[email protected] <mailto:[email protected]>
[email protected] <mailto:[email protected]>
[email protected] <mailto:[email protected]>

EOF

sedCmd=$(sed -E '
        s!([*+-?^{}|.])!\\\1!g
        s/(^.+)/s!^\1$!!/g
' <<< "$emailAddressList")

sedCmd="sed -En '
$sedCmd

s![[:blank:]]+!!g
/^$/d

p

'"

eval "$sedCmd" | sort -u



-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/bbedit.

Reply via email to