[ "$FILTER" ] && list_fex="$(
fex='p'
STRING "$FILTER^" \
- | sed -r 's;\^;\n;g; s;[]\/\(\)\\\^\$\?\.\+\*\;\[\{\}];\\&;g' \
+ | sed -E 's;\^;\n;g; s;[]\/\(\)\\\^\$\?\.\+\*\;\[\{\}];\\&;g' \
| while read -r f; do
- [ ! "${f#~}" ] && continue
- [ "${f#~}" = "$f" ] \
+ [ "${f#\~}" ] || continue
+ [ "${f#\~}" = "$f" ] \
&& fex="/(\ttags=([^\t]*,)?)(${f})((,[^\t]*)?\t)/{${fex}}" \
- || fex="/(\ttags=([^\t]*,)?)(${f#~})((,[^\t]*)?\t)/d; ${fex}"
+ || fex="/(\ttags=([^\t]*,)?)(${f#\~})((,[^\t]*)?\t)/d; ${fex}"
printf '%s\n' "${fex}"
done \
| tail -n1
list_filter(){
if [ "$FILTER" ]; then
- sed -nr "$list_fex"
+ printf "FEX: %s\n" "$list_fex" >&2
+ sed -nE "$list_fex"
elif [ "${SEARCH#!}" != "${SEARCH}" ]; then
grep -aviEe "$(STRING "${SEARCH}" \
- | sed -r ':x s;((^|[^\\])(\\\\)*)\+;\1 ;g; tx;
+ | sed -E ':x s;((^|[^\\])(\\\\)*)\+;\1 ;g; tx;
s;((^|[^\\])(\\\\)*)\\\+;\1+;g;
s; ;\\+;g;')"
elif [ "${SEARCH}" ]; then
grep -aiEe "$(STRING "${SEARCH}" \
- | sed -r ':x s;((^|[^\\])(\\\\)*)\+;\1 ;g; tx;
+ | sed -E ':x s;((^|[^\\])(\\\\)*)\+;\1 ;g; tx;
s;((^|[^\\])(\\\\)*)\\\+;\1+;g;
s; ;\\+;g;')"
else
elif [ $ORDER = Group ]; then
sed -E '
:X
- s;^([^\t]+\t[^\t]+\t[^\t]+\t[^\t]+\t[^\t]+\t[^ 0-9]*)(-[0-9a-zA-Z_-]{11}\r|-ph[0-9a-f]{13}\r|-[0-9]{8}\r|[0-9]+\+?)(.*)$;\1\r\3 \2;;
+ s;^([^\t]+\t[^\t]+\t[^\t]+\t[^\t]+\t[^\t]+\t[^ 0-9]*)-([0-9a-zA-Z_-]{11}\r|ph[0-9a-f]{13}\r|[0-9]{8}\r)(.*)$;\1-\r\3 \2\n;;
+ t;
+ s;^([^\t]+\t[^\t]+\t[^\t]+\t[^\t]+\t[^\t]+\t[^ 0-9]*)([0-9]+)(.*)$;\1\r\3 \2;;
tX;' \
- | { sort -n -k7 |sort -s -k6,6; echo '0 0 0 tags= comment= _'; } \
+ | { sort -n -k7 -k8 -k9 -k10 -k11 |sort -s -k6,6 ; echo '0 0 0 tags= comment= _'; } \
| while read -r length h w t c name; do
if [ "${ln%% *}" = "${name%% *}" ]; then
al=$((al + length))
fi
ln="$name"
done \
- | sort -s -n -k1 |sed -r 's;^[0-9]+\t;metashort\t;;' \
+ | sort -s -n -k1,1 |sed -E 's;^[0-9]+\t;metashort\t;;' \
| sed -E ':X s;^([^\t]+\t[^\t]+\t[^\t]+\t[^\t]+\t[^\t]+\t[^\r]*)\r([^ ]*) ([^ ]+)( .*)?$;\1\3\2\4;; tX'
elif [ $ORDER = Length ]; then
sort -sn -k1 |sed 's;^;metashort\t;;'
printf '%i %s %s\n' \
"$(stat -c %Y "$fn")" "${fm% *}" "$fn"
done \
- | sort -srn -k1 |sed -r 's;^[0-9]+\t;metalong\t;;'
+ | sort -srn -k1 |sed -E 's;^[0-9]+\t;metalong\t;;'
fi
}