DholAholic.com
  WebSite  
   
Go Back   DholAholic.com > The Lounge > Technology Room

Reply
 
LinkBack Thread Tools
Old 25-03-2008, 09:22 PM   #1 (permalink)
J3NIUS
Senior Member
 
J3NIUS's Avatar
 
Join Date: Jun 2005
Location: NORF LONDON
Age: 22
Posts: 1,253
Send a message via AIM to J3NIUS
Gender: Male
Current Mood:
HELPPPPP UNIX tcsh scripting

helpppp i need a script that renames all ascii text files in the current directory by
adding a number to their names before the “extension” using the following format:
<name>_a<number>.<”extension”> .

ANY 1 who can help out would be much appreciated

Thanks

Sanjit
__________________
Carpe Diem,








J3NIUS is offline   Reply With Quote
Old 14-04-2008, 11:43 PM   #2 (permalink)
vodka
Senior Member
 
vodka's Avatar
 
Join Date: Jun 2005
Posts: 1,936
Gender: Undisclosed
Current Mood:
I dont know what you want but i think i knw what you mean try this (Googled it , just like you did) lolol

ctr=1
for i in *
do
var1=`file $i |awk '{printf "%s\n",$3}'`
if [ $var1 = "text" ]; then
filename=`ls $i | cut -f1 -d "."`
ext=`ls $i |awk -F "." '{printf "%s\n",$2}'`
mv $i $filename$ctr.$ext
ctr=`expr $ctr + 1`
fi
done
__________________
HIT EM WERE IT HURTS.


MEIN PUT GURU DASHEMESH DA.

Bhagat Sheik Farid


vodka is offline   Reply With Quote
Old 04-05-2008, 08:15 PM   #3 (permalink)
J3NIUS
Senior Member
 
J3NIUS's Avatar
 
Join Date: Jun 2005
Location: NORF LONDON
Age: 22
Posts: 1,253
Send a message via AIM to J3NIUS
Gender: Male
Current Mood:
THANKS soooo much i got 15 outa 20 for that section
__________________
Carpe Diem,








J3NIUS is offline   Reply With Quote
Old 06-05-2008, 09:28 PM   #4 (permalink)
vodka
Senior Member
 
vodka's Avatar
 
Join Date: Jun 2005
Posts: 1,936
Gender: Undisclosed
Current Mood:
koi gall nahin......
__________________
HIT EM WERE IT HURTS.


MEIN PUT GURU DASHEMESH DA.

Bhagat Sheik Farid


vodka is offline   Reply With Quote
Reply

Bookmarks



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT. The time now is 05:49 AM.

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC6