Extracting A String Between Two Characters in Bash
bash, grep, linux, regex, sed
Solution
You can use:
s='430438229200740352 2014-02-03 14:30:45 CST <HorizonAwon> @SawBlastt @WereAutomatic 101 for me to join as well'
grep -oP '@\K[^ ]*' <<< "$s"
SawBlastt
WereAutomatic
Problem
I need help with extracting a string between the "@" symbol and a space " " in Bash. I'm using Python Twitter Tools, and the output is like this: ``` 430438229200740352 2014-02-03 14:30:45 CST <HorizonAwon> @SawBlastt @WereAutomatic 101 for me to join as well ``` I need to extract the two strings: SawBlastt WereAutomatic I also need to set them each as a separate variable. I've tried messing around with sed and grep, but no successful results. I'm really stuck on this. Help is very appreciated. Thanks!