there's more I want to do to this script, but it serves it's purpose.
smv renames a file based on a sed search and replace string. like so:
#
lsfile
#
smv 's/il/3333/g' file# ls
fi3333e
combined with my 'yargs' script I posted on here, you can do large batches of files this way.
Code:
#!/bin/bash
#released under the GPL v2
if [ $# -lt 1 ]; then
/bin/echo "Usage: smv sed_expression filename"
exit 1
fi
if [ ! -e "$2" ]; then
echo "file [""$2""] doesnt exist.";
exit;
fi
SEDED=$(echo $2 | sed "$1");
if [ -e "$SEDED" ]; then
echo "file [""$2""] already exists.";
exit;
fi
cp "$2" "$SEDED"
if [ ! -e "$SEDED" ]; then
echo "failed to copy.";
exit;
fi
rm "$2"
if [ -e "$2" ]; then
echo "failed to delete.";
exit;
fi