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_FolderHowever, 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.
Mac Terminal command - Find string and print with surrounding line
grep;terminal;macintosh;ack
If I'm understanding you correctly, to:print out the line around the stringyou can use grep's -C (context) option, like so:grep -aRi -C 1 search_string /path_to_Folderwhich will print three lines for every match: the line before the match, the matching line, and the line after the match.Since the database files were binary, we also need grep's -a flag, so that it treats files as text. Sample run:$ grep -aRi jeff *a/b/c/i:jeffa/b/i:jeffa/i:jeffi:jeffvs$ grep -aRi -C1 jeff *a/b/c/i-hia/b/c/i:jeffa/b/c/i-bye--a/b/i-hia/b/i:jeffa/b/i-bye--a/i-hia/i:jeffa/i-bye--i-hii:jeffi-bye