Reputation: 121
I have several large text files that I want to grep the thousands of records in them that have a string on 1 line of each record that says "1 name userabc.db" or "1 name xy040101.db" or "1 name abcdfr.db" or "1 name efgh.db" for example.
The string "userabc.db", etc, could have uppercase letters in this name, like USERABC.DB, or Userabc.db or userAbc.db, anywhere in the name of the .db file..
So I need to be able to search for and identify this line in each record that has an uppercase letter anywhere on this line, if any.
When I use "grep '[1 name ][A-Z] ./store.txt" no double quotes, I find :
"1 name USERxxx.db" and "1 name Xy040101.DB" and "1 name Abcdfr.db" and "1 name EFGH.DB" but not when the uppercase letter or letters begins at the 2nd or subsequent letter position of the .db file name in the line in question.
Bottom line is I need to be able to find all lines that have an uppercase letter or letters when these letters are anywhere in the name of the .db file not just at the beginning or when all letters are uppercase..
Can this be done ? maybe better done with sed or awk ?
Thanks, Bob Perez ([email protected])
Upvotes: 1
Views: 787
Reputation: 54512
All you need is:
grep "1 name .*[A-Z].*" ./store.txt
.*
will match any character any number of times.
Upvotes: 0