For Programmers: Free Programming Magazines  


Home > Archive > AWK > November 2004 > Re: confused with regular expression









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: confused with regular expression
Bill Marcum

2004-11-16, 6:50 pm

On 2 Nov 2004 20:00:08 -0800, moggces
<juihuahsieh@nhri.org.tw> wrote:
> Sorry
> I am not sure what was wrong.
>
> I have a file which has two pattern
>
> 5673058-
> AE-848/14271200-
>
> in command line I typed: awk '/^[0-9]/ { print }' file , tried to get
> "5673058-" but it printed nothing so I tried to type awk --re-interval
> '/[0-9]{7}/ { print}' file strangely, it didn't print "5673058-" but
> instead it printed "AE-848/14271200-"
>

Perhaps the file contains a CR character, so that it prints
"AE-848/14271200-" on top of "5673058-".

--
Of course power tools and alcohol don't mix. Everyone knows power
tools aren't soluble in alcohol...
-- Crazy Nigel
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com