src_prepare-overlay/scripts/remove-version-match.sh

9 lines
179 B
Bash
Raw Normal View History

#!/bin/sh
if [ -z $1 ]; then
echo "Must specify a file to modify..."
exit 1
fi
2020-04-30 04:42:11 +02:00
regex='^=?(\S+)(?:-[[:digit:]]+\S*)(\s)(\S+)$'
sub='\1\2\3'
perl -pe "s;$regex;$sub;gm" -i "${1}"