Skip to content

Instantly share code, notes, and snippets.

@nipunthathsara
Created November 3, 2022 21:26
Show Gist options
  • Save nipunthathsara/b3035510a10c74d0f8e46d5e98324789 to your computer and use it in GitHub Desktop.
Save nipunthathsara/b3035510a10c74d0f8e46d5e98324789 to your computer and use it in GitHub Desktop.
Dynamic input grep script
#!/bin/bash
input=input
ii=0
jj=0
counter=0
for IN in `cat $input`; do
# echo $IN
if [ $counter == 0 ]
then
ii=$IN
counter+=1
else
jj=$IN
counter=0
echo "grep -r "\"$ii\"" /Users/RM55LU/data/repos/gg/configs/*/src/main/sql | grep \"$jj\""
grep -r "$ii" /Users/RM55LU/data/repos/gg/configs/*/src/main/sql | grep "$jj"
fi
# echo "1 -> $ii , 2 -> $jj "
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment