8 lines
514 B
Bash
Executable File
8 lines
514 B
Bash
Executable File
#!/bin/sh
|
|
input="$(sed 's/.*│//g' | tr -d '\n' | grep -oE '([[:alnum:]_.-]+@[[:alnum:]_.-]+?\.[[:alpha:].]{2,6})' "$@" | sort -u)"
|
|
#This loop is required since it would otherwise read <mail>@subdomain.domain.tld as two email addresses (<mail>@subdomain.domain and <mail>@subdomain.domain.tld)
|
|
emails="$(for str in $input; do
|
|
[ "$(echo "$input" | grep -c "$str")" -eq 1 ] && echo "$str"
|
|
done )"
|
|
[ -n "$emails" ] && echo "$emails" | dmenu -i -p 'Copy which email?' -l 10 | tr -d '\n' | xclip -selection clipboard
|