I'm trying to find lines similar to these input strings. Basically -a single or double quote -followed by 1 or more blanks -followed by rm -followed by 1 or more spaces
Below would be some example matches.
build2('rm myfile')
build2(" rm myfile')
'rm myfile'
I can use a regex tester like regexpal dot com and it works fine but how would I do it using grep if my input file is called myfile.txt? I've tried the command from shell prompt below but grep does nothing but response with a > character on the next line.
grep "['"] *rm *" myfile.txt
You use double quotes around your call to grep. Therefore, you need to escape the double quote inside your pattern.
grep "['\"] *rm *" myfile.txt
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.