Merge branch 'master' of gitlab.com:src_prepare/scripts

This commit is contained in:
Maciej Barć 2020-05-16 02:25:49 +02:00
commit f276798372
No known key found for this signature in database
GPG Key ID: 031C9FE65BED714A
1 changed files with 13 additions and 0 deletions

13
src/remove-version-match Executable file
View File

@ -0,0 +1,13 @@
#!/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.
#
if [ -z "$1" ]; then
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}"