On Mon, Sep 09, 2024 at 01:34:55PM -0600, home user via users wrote:
On 9/9/24 11:35 AM, Samuel Sieb wrote:
On 9/9/24 9:55 AM, home user via users wrote:
On 9/8/24 8:36 PM, ToddAndMargo via users wrote:
On 9/8/24 18:51, home user via users wrote:
Are you looking for "9.4.4" or "9.4.5"?
Aw poop! yes 9.4.4
Still can't get it to work though
Now I don't understand!
In "grep" with no command line options (or at least no "-F" option) and no escapes in the search string, which is it: In the search string,
1. '.' matches any one character, or
2. '.' matches any one character except '.'?
I thought it was #1.
It is.
I would have thought that grep (and grep -i) would have produced at least one match once Todd corrected the typo in the search string. But he reported that he still couldn't get it to work. The "-F" option should not have been needed, right?
Yes, it does work with just '9.4.4' as well.
ok. Thank-you, Samuel.
A true but incomplete answer. Just because some RE gets you the data
you want in one example dataset does not mean it was the correct RE.
As noted, the dots (".") will match any character when used with grep.
So yes, it will find "9.4.4" because those literal dots match any char.
But that RE would also match a zip code, "90434", and output data you
did not want. It would also match 5 chars of a date like, "9/4/47".
If you do not want extraneous output then you have to tell grep the
dots are literal, not metachars. I.e. the RE argument to grep must
be 9\.4\.4 (I left off quotes to avoid confusion). There are several
ways to do this, and all must consider that the shell has first shot
at modifying the RE argument.
grep 9\\.4\\.4 datafile
grep "9\.4\.4" datafile
grep '9\.4\.4' datafile
Double and single quotes seem equivalent here. But note that inside
single quotes the backslash is always literal, not special, while inside
double quotes it depends on the character following the backslash. If
it is a dollar sign ($), a back tic (`), a backslash (\), or a double
quote (") then the backslash quotes the following character.
echo "He said \"Oh my gosh\" out loud."
echo "The price was \$1.98!"
echo "Each line of the file ended with a \\"
--
Jon H. LaBadie jonfu@xxxxxxxxxx
--
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue