Sample Header Ad - 728x90

Mac Terminal command - Find string and print with surrounding line

2 votes
1 answer
19843 views
I have been testing using ack, sed, grep trying to search through files in a directory to find a particular string. I am looking through my database files to check to see if passwords are listed in clear text. So far, I have been able to use this command: grep -Ri "search_string" /path_to_Folder However, this only outputs the files that contain the string. I want to go one step further and print out the line around the string so I don't have to go in and search each file. I hope that make sense. Thank you so much.
Asked by user3324136 (123 rep)
Feb 26, 2017, 02:39 AM
Last activity: Feb 27, 2017, 02:19 AM