I am trying to grep
for a word in a directory - but I want to check for numbers 1-9 in the word.
This is a simple grep:
grep -r L01auxillar /pr/solder/
I want the grep
command to search: grep -r L0[1-9]auxillar /pr/solder/
I am trying to grep
for a word in a directory - but I want to check for numbers 1-9 in the word.
This is a simple grep:
grep -r L01auxillar /pr/solder/
I want the grep
command to search: grep -r L0[1-9]auxillar /pr/solder/
If you don't want to use regexes within grep, you could do the number expansion in the shell:
grep -r --regexp=L0{1..9}auxillar /pr/solder/
You could use a wildcard for the one character.
grep -rn '/home/user/temp' -e '\<asd.f\>'
# use operator w if you want to catch whole words
grep -rnw '/home/user/temp' -e '\<asd.f\>'
Output:
/home/user/temp/test:1:asd4f
/home/user/temp/test:2:asd5f
But it would also give matches with other chars (eg asd0f or asdgf).