-
-
Save mikelittle/d145809ce276bdbad42b to your computer and use it in GitHub Desktop.
Rename file plugin contents
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/sh | |
# awk script: | |
# set field separator to : | |
# strip comma from field 2 | |
# strip quotes from field 2 | |
# strip lead space from field 2 | |
# strip trail space from field 2 | |
# print field 2 | |
for FILE in `ls *.json` ; do | |
NAME=`cat $FILE | grep title | awk 'BEGIN { FS= ":" } { gsub( ",", "", $2 ); \ | |
gsub( "\"", "", $2 ); \ | |
gsub(/^[ \t]+/,"",$2); \ | |
gsub(/[ \t]+$/,"",$2); \ | |
print $2 }'` | |
#echo $NAME; | |
#give a different extension or move to a diff folder to stop processing them endlessly | |
mv "$FILE" "$NAME.xtx" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment