cschwan/sage-on-gentoo — comment on commit 77e9bffd279d976fa2ef31c1861f99f865529421
File:  line 0
By cschwan:

I am using a script in portage's bashrc which finds out those candidates automatically. If you are interested in it, place

# check for useless sed commands, see thread on gentoo-dev:
# [gentoo-dev] RFC: sed script redundancy
my_sed() {
local oargs=( "$@" )
local arg
local nargs=()
local hadi=
local hade=

while [[ -n $1 ]] ; do
case "$1" in
-i|--in-place)
# ignore this flag
hadi=yes
;;
-e|--expression|-f|--file)
arg="$1"
shift
nargs+=( "${arg}" "$1" )
hade=yes
;;
-*)
nargs+=( "$1" )
;;
*)
if [[ -z ${hade} ]] ; then
nargs+=( "-e" "$1" )
hade=yes
elif [[ -z ${hadi} ]] ; then
# there is no inline replacing, not much we can do
break
else
sed "${nargs[@]}" "$1" | diff -q "$1" - > /dev/null && \
ewarn "sed ${nargs[@]} has no effect on $1"
fi
;;
esac
shift
done

sed "${oargs[@]}"
}

alias sed=my_sed

in /etc/portage/bashrc