Reputation: 457
I am trying to fetch a line with the following information -a string1 -b file1.txt -c string3
using grep.
I tried
grep -v grep | grep '[b][:space:] *.txt *[c]'
grep -v grep | grep '[b] *.txt *[c]'
string1, string3 and file1 are variables. So I am looking for solutions using wild characters.
But there is nothing returned. Any help will be appreciated.
Upvotes: 0
Views: 1058
Reputation: 785286
You may use this grep
:
grep -- '-a [^[:blank:]]* -b [^[:blank:]]*.txt -c [^[:blank:]]*' *.txt
[^[:blank:]]
matches any non-whitespace character.--
separates options and pattern arguments.Upvotes: 2