![]() |
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 |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| renaming xls file | systemsb | UNIX for Dummies Questions & Answers | 2 | 10-19-2007 07:50 AM |
| Help in renaming file !!! | kumarsaravana_s | UNIX for Dummies Questions & Answers | 5 | 05-02-2007 12:45 PM |
| renaming part of a file | ajaya | Shell Programming and Scripting | 0 | 04-11-2006 10:00 PM |
| renaming the file with the timestamp | ajubi | Shell Programming and Scripting | 6 | 12-05-2005 06:21 AM |
| Renaming a file name | dbrundrett | Shell Programming and Scripting | 2 | 01-06-2004 10:36 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi All,
I was wondering if anyone knows how i take in a file, format the file, and then rename the file as the same name as the input file in shell script. Here is an example of what I am doing: if [[$1=""]] then echo "please enter a filename" else export infile=$1 I take in a file "$infile" Then I do my formatting..... Now I want to rename the formatted file back to $infile. How can I do this? Right now it is renaming the file before any formatting is done...and the formatted $infile is empty. Please help me if possible. Thanks. |
|
||||
|
Depends on your formatting you are doing.....if you're just sorting then you're okay to use the same filename for output - just use the -o flag. If your doing pretty much anything else - which I assume you are...then temp file is the only way.
I'd use mv rather than cp though.....so you don't have left over files. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|