1
Fork 0
mirror of https://github.com/Steffo99/config-fish.git synced 2024-12-22 23:04:22 +00:00
config-fish/functions/regex_mv.fish

30 lines
502 B
Fish
Raw Normal View History

2021-09-17 22:42:20 +00:00
function regex_mv
echo_progress "Find: "
echo_highlight "$argv[1]"
echo
echo_progress "Replace with: "
echo_highlight "$argv[2]"
echo
echo
for old in (ls)
set new (echo $old | sed -r "s/$argv[1]/$argv[2]/g")
echo_progress "$old"
echo_highlight "$new"
echo
end
if not confirm
return 1
end
for old in (ls)
set new (echo $old | sed -r "s/$argv[1]/$argv[2]/g")
mv "$old" "$new"
end
end