I needed to replace {.htm} files with {.html} extensions in
100's of files in a directory :
Heres what I did :
[root@unixguy scripts]# ls
file1.htm file2.htm file3.htm
[root@unixguy scripts]# for list in `ls -1t *.htm*`
> do
> prefix=`echo $list | awk -F"\." '{print $1}'`
> mv $list ${prefix}.html
> done
[root@unixguy scripts]# ls
file1.html file2.html file3.html
One more way of doing this :
[root@unixguy scripts]# ls
file1.html file2.html file3.html
[root@unixguy scripts]# ls *.html | awk -F '.'
'{print "mv "$1".html "$1".htm"}'| csh
[root@unixguy scripts]# ls
file1.htm file2.htm file3.htm
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment