Skip to content

Instantly share code, notes, and snippets.

@wataruoguchi
Last active May 17, 2016 20:57
Show Gist options
  • Select an option

  • Save wataruoguchi/6fbd2eab9d450addf89a7ed4feac8538 to your computer and use it in GitHub Desktop.

Select an option

Save wataruoguchi/6fbd2eab9d450addf89a7ed4feac8538 to your computer and use it in GitHub Desktop.
#!/bin/bash
word="$@"
datetime=$(date +'%Y%m%d%H%M%S')
filename=$(echo $word | sed -r 's/(^| )([a-z])/\U\2/g'|tr '\n' ' ')
filename=$(echo "grep_"$filename"_"$datetime".txt" | tr -d '[[:space:]]')
find ./ -regex ".*\.php" -type f -print | xargs grep "$word" >> "$HOME/$filename"
find ./ -regex ".*\.js" -type f -print | xargs grep "$word" >> "$HOME/$filename"
echo "DONE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment