matching $ 
Author Message
 matching $

Hi.  I'm having trouble matching the ascii character $.
Usually when I have this sort of problem I use the octal value --
ie., gawk '/\044/ {print}' in this case, but all lines are being
selected.

I'm working on AIX.



Sun, 14 Jul 2002 03:00:00 GMT  
 matching $

Quote:

>Hi.  I'm having trouble matching the ascii character $.
>Usually when I have this sort of problem I use the octal value --
>ie., gawk '/\044/ {print}' in this case, but all lines are being
>selected.

>I'm working on AIX.

I tried this using gawk on both SunOS and Linux systems, and both times all
lines were printed. However,

        gawk '/\$/ {print}' filename

correctly prints only lines with a "$" in them, and

        gawk '/^\$/ {print}' filename

prints only those lines that start with a "$".

Steve O'Neill



Sun, 14 Jul 2002 03:00:00 GMT  
 matching $

Quote:


>>Hi.  I'm having trouble matching the ascii character $.
>>Usually when I have this sort of problem I use the octal value --
>>ie., gawk '/\044/ {print}' in this case, but all lines are being
>>selected.
...
>If /\$/ doesn't work, try /\\$/

Counting backslashes is a PITA. Try /[$]/


Mon, 15 Jul 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. match works, don't match doesn't

2. iss-matching - the free Regular Expression / Pattern Matching cluster

3. to match and not to match

4. how to do exact match for all characters using re.match()

5. String Match - not matching

6. re.match(...) fails to find a match

7. regexp matching to shortest instead of longest match?

8. Regexp finditer() fails to match some non-overlapping matches?

9. "Grudge Match Pool" Beta

10. regular expression matching in J ? (or APL)

11. 'No font matching ...' problem

12. Help matching wildcards in DSN's

 

 
Powered by phpBB® Forum Software