Last active
August 29, 2015 14:17
-
-
Save duyet/16df26b3d487411429aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Find all string from input, and search all file (*.txt) contains this strings. | |
# Van-Duyet Le <[email protected]> | |
# Homepage: http://lvduit.com | |
ext="./*.txt" | |
read -p "Your input string: " input | |
echo 'List file containt "' $input '"' | |
# Option 1 ----------------------------- | |
for f in $ext | |
do | |
if grep -l $input $f; then | |
echo $f; | |
fi | |
done | |
# Option 2 ------------------------------ | |
grep -r $input $ext | cut -d: -f1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using Option 1 or Option 2