Created
December 6, 2018 15:55
-
-
Save hdznrrd/afbfd12506d8a8b447533ec5b73494ee to your computer and use it in GitHub Desktop.
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 | |
# [email protected] | |
# fix jscut.org gcode comment format so it works with uccnc | |
if [ ! -e "$1" ]; then | |
echo "no file given, exiting" | |
exit 1 | |
fi | |
if [ "$2" != "" ]; then | |
echo "only single file parameter allowed, exiting" | |
exit 1 | |
fi | |
dos2unix "$1" | |
tmp=$(mktemp) | |
cat "$1" | perl -pe 'm/^(.*?)(?:;(.*))?$/; $_="$1$/"; $_="$1 ($2)$/" if defined $2;' > "$tmp" | |
mv "$tmp" "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment