Last active
August 29, 2015 14:08
-
-
Save baelter/363d93a33f9176c92669 to your computer and use it in GitHub Desktop.
Search netCDF files for keys
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
#!/bin/bash | |
path=${@: -2:1} | |
term=${@: -1:1} | |
if [[ !(-d $path) ]]; then | |
echo "Usage: ncfind [-f] PATH PATTERN" | |
exit 0 | |
fi | |
execs="find . -name '*.nc' -exec grep -E -i -a -q '$term' {} \; -print " | |
if [[ $1 != '-f' ]]; then | |
execs="$execs | xargs -t -L 1 ncdump -h " | |
fi | |
echo "eval $execs" | |
eval $execs | |
exit 1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment