Skip to content

Instantly share code, notes, and snippets.

@rabernat
Created October 25, 2017 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rabernat/90cd307e9cdf8c774a42fd6ed2264fe9 to your computer and use it in GitHub Desktop.
Save rabernat/90cd307e9cdf8c774a42fd6ed2264fe9 to your computer and use it in GitHub Desktop.
#!/bin/bash
pmeta=$( ls -t pickup.*.meta |head -1 )
plabel=$( echo $pmeta | sed 's/pickup.\(.*\).meta/\1/' )
# strip from data
sed -i.bak -n -e '/pickupSuff/I!p' data
if [ "${plabel:0:1}" == "c" ]
then
# we have a partial checkpoint
iter=$( grep timeStepNumber $pmeta | sed -e 's/.*\[ \(.*\) \];/\1/' )
extra="\n pickupSuff='$plabel',"
else
iter=$plabel
fi
# update iteration number
sed -i.bak -e "s/nIter0=\(.*\)/nIter0=$iter,$extra/I" data
echo "Updated data: pickup $iter ($plabel)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment