On 13/07/10 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>
I don't want the whole line, just the word.
You can even do it with just grep:
mak@yoda:~$ (echo hi; echo 'now $food fight $win'; echo '$$$'; echo there) | grep -E -o '$\w+' $food $win
Cheers,
-- Martijn