I have a bash script.
I need to look if “text” exists in the file and do something if it exists.
I have a bash script. I need to look if text exists in the
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you need to execute a command on all files containing the text, you can combine
grepwithxargs. For example, this would remove all files containing “yourtext”:To search a single file, use
if grep ...