################################################## # USAGE: # jessy_renumber FILENAME # Renumber effects in jessyink with a distance of 10 between effects. FILENAME=$1 function main(){ nums=$( \ cat $FILENAME|grep "sodipodi:role=\"line\">[0-9]*"| \ sed -e 's/[^0-9]*\([0-9]*\).*/\1/'| \ sort -nr| \ uniq) len=$(echo $nums|wc -w) # Length of array (number of effect orders) j=$(( 10 * len )) for i in $nums;do strA="sodipodi:role=\"line\">"$i"<\/tspan><\/text>" strB="sodipodi:role=\"line\">"$j"<\/tspan><\/text>" echo $strA echo $strB sed -i -e "s/$strA/$strB/g" $FILENAME # Use double quotes to expand variable names j=$(( j - 10 )) done } main