scripts/src/remove-version-match

14 lines
396 B
Plaintext
Raw Normal View History

2020-05-03 20:38:43 +02:00
#!/bin/sh
# Author: xenhat <me@xenh.at>
# Description: A script to remove explicit version match in portage configuration files.
# Developed for /etc/portage/package.accept_keywords, may or may not
# not work onther files.
#
2020-05-03 20:43:27 +02:00
if [ -z "$1" ]; then
2020-05-03 20:38:43 +02:00
echo "Must specify a file to modify..."
exit 1
fi
regex='^=?(\S+)(?:-[[:digit:]]+\S*)(\s)(\S+)$'
sub='\1\2\3'
perl -pe "s;$regex;$sub;gm" -i "${1}"