webcentive.com Blog

This Blog is to talk about webcentive.com. Offer suggestions, say you were here, etc. webcentive - home

Saturday, April 25, 2009

awk script to rename files

cat rename.awk
{
split($1,a,".")
printf("mv %s %s.category.txt\n",$1, tolower(a[1]))

}


Output:


awk -f rename.awk tvctmp

mv 3dmodel.text.html 3dmodel.category.txt
mv TVOnline.text.html tvonline.category.txt
mv accounting.text.html accounting.category.txt
mv airgun.text.html airgun.category.txt
mv airline.text.html airline.category.txt
mv anime.text.html anime.category.txt
mv antenna.text.html antenna.category.txt

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home