On 13 Jul 16:28, Richard Parsons wrote:
Friends,
I admit that I am terrible with regex. I need a script to output all words beginning with "$" from a text file. Here's what I've got so far:
cat file.txt | grep "$" | sed <some-regex>
How about:
sed -e 's#[^$]*($[^[:space:]]*)#\1 #g; s#(.*)([$][[:alpha:]]*).*$#\1\2#; s# #\n#g;' file.txt
Cheers,