voidrice/.scripts/tools/rotdir

17 lines
243 B
Text
Raw Normal View History

2019-03-09 20:27:10 +00:00
#!/bin/sh
2019-03-13 00:29:11 +00:00
if [ -z "$1" ]; then
echo usage: rotdir regex 2>&1
exit 1;
fi
ed -s <<EOF
# Read in all files in the current dir
r !find "$PWD" -maxdepth 1
# Search all lines for regex, move to top
g/$1/m0
# Print all lines
,p
# Force quit
Q
EOF