Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Extract names and emails from a text file' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Extract names and emails from a text file
Authored by: Lri on Feb 20, '13 09:52:53AM

You could also use sed -n 's///p':

sed -En 's/^From: .*<(.*)>$/\1/p'
sed -En 's/^From: (.*) <.*>$/\1/p'

IFS affects ( $value ) but not ( "$value" ):

line=x,y,z; IFS=, cols=( $line ); echo "${cols[1]}" # y
line="x y z"; cols=( "$line" ); echo "${cols[0]}" # x y z


[ Reply to This | # ]