Using grep, how would I do this in one command line?
I have this so far
grep '\$[0-9][0-9]\.[0-9][0-9]' money.txt with various strings in the text file, but I'm having issues satisfying some of my conditions.
I'm trying to search for any lines that contain dollar values from $10.00 to $99.99 (dollar sign+keeping two digits after the decimal point), and mine will catch everything, but that even includes when you have text before or after it
I want them to only be caught if there's a space either before (e.g. end of the line), after (start of the line), before & after (middle of the line), or none at all (e.g. only string in the line).
I've tried adding \s but then it doesn't print anything at all (even something valid like
abc $15.64 xyz), though they print fine if I make them optional (using *). So, I assume it just completely ignores \s since it doesn't seem to satisfy anything.
Note: I only want to make spaces optional because I need it to also print the line when the dollar values are at the start or end of the line, in which case there wouldn't be a space before or after them, respectively. Even if I could get the \s to work, making it optional would still match strings like
Any idea how I could make this work?