Skip to content

Instantly share code, notes, and snippets.

@eamonnmag
Created September 27, 2011 10:12
Show Gist options
  • Save eamonnmag/1244756 to your computer and use it in GitHub Desktop.
Save eamonnmag/1244756 to your computer and use it in GitHub Desktop.
Script to do mass string replacement on files in a folder.
OLD="http://files.ivec.org/bpa_wheat/*"
NEW="http://files.ivec.org/bpa/raw/agrf/*"
DPATH="/home/isauser/BPA-Wheat-Cultivars-3"
BPATH="/home/isauser/BPA-Wheat-Cultivars-3-fixed"
for f in `ls $DPATH`
do
FULLPATH=$DPATH"/"$f
echo "processing $f `date`" >>Change.log
sed "s/$OLD/$NEW/g" $FULLPATH > $BPATH"/"$f
echo "processed $ `date`" >>Change.log
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment