when grepping will this expression math anything?
grep '*U" thefile
It dosen't seem to. It says Match zero or more of nothing and then a U.
Am I missing something?
Thanks
Jeem
grep '*U" thefile
It dosen't seem to. It says Match zero or more of nothing and then a U.
Am I missing something?
Thanks
Jeem
> grep '*U" thefile
> It dosen't seem to. It says Match zero or more of nothing and then a U.
> Am I missing something?
grep 'U*' thefile
That will match any line that contains zero or more U's.
Don't be surprised when you find that it matches every single
line in the file. Every line will contain at least zero U's.
--
Andreas K?h?ri
> grep '*U" thefile
Pick either type of quotation mark and it'll match a sequence of zero orQuote:> It dosen't seem to. It says Match zero or more of nothing and then a U.
> Am I missing something?
> Thanks
> Jeem
grep 'U'.
Regards,
Ed.
Originally posted by Ed Morton
> > when grepping will this expression math anything?
> > grep '*U" thefile
> You're mixing quotation marks - pick either single-tick, ', or
> double-tick, ", for both ends of the RE.
> > It dosen't seem to. It says Match zero or more of nothing and
> then a U.
> > Am I missing something?
> > Thanks
> > Jeem
> Pick either type of quotation mark and it'll match a sequence
> of zero or
> more spaces followed by a U. You'd get the same effect with just
> grep 'U'.
e.g.
echo "*U" | grep "*U" # match found
echo "U" | grep "*U" # no match found
--
Posted via http://dbforums.com
You're correct. The '*' is taken literally (i.e. it has noQuote:> Not sure which greps this might apply to but mine will interpret a *
> as exactly that at the beginning of the regular expression and
> doesn't treat it as a metacharacter. I can't see any reference to
> this in the man page.
> e.g.
> echo "*U" | grep "*U" # match found
> echo "U" | grep "*U" # no match found
--
Andreas K?h?ri
<snip>
<snip>Quote:> Not sure which greps this might apply to but mine will interpret a *
> as exactly that at the beginning of the regular expression and
> doesn't treat it as a metacharacter. I can't see any reference to
> this in the man page.
I thought he had a single blank immediately before the "*" in his RE. It
looked that way in the font I use and his description sounded like he
was trying to describe the effect that would have. Looking at it again,
I see there was no blank so my description was wrong. Thanks for
catching it.
Ed.
>> grep '*U" thefile
>> It dosen't seem to. It says Match zero or more of nothing and then a U.
>> Am I missing something?
> You have it back to front:
> grep 'U*' thefile
> That will match any line that contains zero or more U's.
In that case, try one of these:
grep '\<U' thefile
grep '\bU' thefile
This requires GNU grep, which extends the POSIX definition of
the utility.
Does anyone know what the difference between \b and \< is? It's
not entierly clear from the GNU grep manual I think.
--
Andreas K?h?ri
> grep '*U" thefile
> It dosen't seem to. It says Match zero or more of nothing and then a U.
> Am I missing something?
expressions matched by grep and other text utilities. They are not the
same.
--
Kevin Rodgers
Hi all
I'm not sure if this is particularly unix.programmer related but I'm trying to use it under unix.
I'm trying to do a regular expression search in c using the regex.h library.
I think I need to use the re_search function but I'm not sure how to actually
go about it.
Can anyone give mee an example of a working function that uses the re_search
function?
If I should post this on another newsgroup, please let me know.
Regards Nick
3. regular expression library calls caused core-dumped
4. Comparisons, pricing on network file servers
6. trouble with interlaced modes
7. regular expression in C programming
10. Regular expression matching in sh
11. Regular Expression Syntax Limitation?
12. Why there isn't negation operator for regular expression ?