Last active
January 30, 2019 10:11
-
-
Save milovtim/fb5e6c90cf88857c760ae1e1fb7892bd to your computer and use it in GitHub Desktop.
Grap keys from bunch of .properties files with keys with [a-z _ .]
This file contains 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
#!/usr/bin/env bash | |
# files with prop keys on each line | |
KEYS_FILE="/path/to/result.list" | |
# Extract keys to file | |
awk -F = '/^[a-z_.]+=/ { print $1 }' /some/path/files > "$KEYS_FILE" | |
# path to some repo | |
SEARCH_PATH="/path/to/repo" | |
# Search each prop key in given folder with exclusions | |
while IFS='' read -r line || [[ -n "$line" ]]; | |
do | |
echo "Parse $SEARCH_PATH for $line" | |
RESULT=$(fgrep "$line" \ | |
--exclude .git/** \ | |
--exclude binaries/** \ | |
--recursive \ | |
"$SEARCH_PATH") | |
if [[ -n "$RESULT" ]] | |
then | |
echo "$RESULT" > "results/${line}.result" | |
fi | |
done < "$KEYS_FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment