#!/usr/bin/env bash
FILE_LIST="`ls *.html`"
echo FILE_LIST: ${FILE_LIST}
for f in ${FILE_LIST}
do
sed 's/$1/$2/g' f> TMPFILE &&
mv TMPFILE f
done
echo "replace Script done"
Cut usage:
http://www.thelinuxblog.com/using-cut-shellscript-string-manipulation/
bingsun2% echo "daemon:x:1:1:daemon:/usr/sbin:/bin/sh" | cut -d: -f1,5
daemon:daemon
//To batch rename jan09 to 09jan
//`` is to force sh to execute as command
for i in $(ls ~/fay)
do
a=`echo $i | cut -c1-3`
b=`echo $i | cut -c4-5`
mv $i $b$a
done
No comments:
Post a Comment