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.
grep -F -- '-a string1 -b file1.txt -c string3' file*" doesn't mean "any string", it means "zero or more of whatever's right before this". To get "any string", you need "zero or more of any character", which is ".*". Also, to use a named character class, you need square brackets inside a square bracket expression (i.e. two sets of square brackets): "[[:space:]]"