Reputation: 1080
I'm trying the following and unable to get the desired results:
cat sfd_log.txt | grep '12/*/17' | more
My objective is to get all December 2017 entries from the file. Thank you.
Upvotes: 1
Views: 941
Reputation: 39374
grep
uses (optionally extended) regular expression syntax. Bash uses globbing. Similar enough to be confusing, but different enough to be important:
grep '12/.*/17' sfd_log.txt | more
Or, more precise if you like:
grep -E '12/[0-9][0-9]?/17' sfd_log.txt | more
What you actually asked for with "12/*/17" is:
a literal '12' followed by 0 or more literal '/' followed by a literal '/17'".
Upvotes: 1