![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to get file extension | shirleyeow | Shell Programming and Scripting | 17 | 01-17-2008 08:40 AM |
| extension problem please help | sharmasdeepti | UNIX for Dummies Questions & Answers | 1 | 10-24-2007 07:29 AM |
| without extension | adurga | UNIX for Dummies Questions & Answers | 3 | 07-02-2007 12:34 PM |
| Changing userID and Changing group and GID | deal732 | Shell Programming and Scripting | 2 | 04-18-2007 10:09 AM |
| Lynx - Downloading - extension handling - changing mime type? | yitzle | UNIX for Dummies Questions & Answers | 2 | 10-17-2006 11:46 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Changing extension
Hi ,
I need to replace the file name extension with txt to csv,i wrote the below script when executing its giving the below error.Please anyone how to do this? $ a2.sh mv: *.: cannot access: No such file or directory ./a2.sh[7]: o: bad number $ vi a2.sh a2.sh ----- #!/bin/ksh txt=$1 csv=$2 for file in *.$txt ; do mv $file ${file%$txt}$csv done exit o Thanks , Mohan |
|
||||
|
ur script looks wrong...
for loop expects a list for action. "for file in *.$txt" means what??? if u are providing list as the 1st argument ( as u wrote in ur code) than why u are not supplying list when executing the script. if u want to do with all the file in the current dir use for file in `/bin/ls *.txt` and if as an argument, use for file in $* correct me anyone if i m wrong... |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|