Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Modify multiple filename ksh script
Name: lspvvq Date: June 27, 2007 at 19:57:25 Pacific OS: UNIX CPU/Ram: not sure Product: not sure
Comment:
I have a folder with a large amount of .mdl and .att files. There are also some with extensions after that .att or .mdl. An example of each:
Name: thepubba1 Date: June 28, 2007 at 21:07:24 Pacific
Reply:
#!/bin/ksh for file in * do if [[ $file == *".mdl" ]] || [[ $file == *".att" ]] then case $file in *".att" ) mv $file "${file%%.*}.EG.att" ;; *"T.mdl" ) mv $file "${file%%.*}.EGT.mdl" ;; *"S.mdl" ) mv $file "${file%%.*}.EGT.mdl" ;; esac fi done
This will handle the files that end in .att or .mdl. Not sure if you want the .orig files renamed. If so, just ask and I'll post how to do that.
0
Response Number 2
Name: lspvvq Date: July 2, 2007 at 06:01:15 Pacific
Reply:
Ok, so I guess I am a beginner still at scripts because I can't get the script to work. Do I need to make the script a certain type of executable? Should it be a .sh or .exe file?
Do I need to specify the path of the folder to be edited in the script somewhere?
Summary: Hi All: I am a newbie for ksh scripting.My code doesn't work. Can someone help? I am trying to automate the process of file read from a directory. The files older than 3 days are supposed to be archiv...
Summary: Hello, I have a Ksh script problem. The scrip is polling a directory every 5 mins to get a file, which contains the input line like "put abc.dat /home/test" etc. If the file contain is not empty, th...
Summary: hi all, i have face new prolem in writing my bash script. my problem is that i want to write a script that will accept any number of arguments and return the newest file from the list. and i only mana...