Skip to navigation
Extract all emails from bash string
07.10.21
Extract all emails from bash string string="foo@bar.com bar@foo.com" emails=$(echo $string | grep -Po '\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+') emails=${emails//[$'\t\r\n']} && emails=${emails%%*( )} #remove newline echo "${emails}" #show it
Reply
Anonymous
Information Epoch 1751862199
Use shell scripts to increase leverage and portability.
Home
Notebook
Contact us