The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
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 to the same name lachino8 UNIX for Dummies Questions & Answers 3 07-31-2002 08:52 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-06-2004
dbrundrett dbrundrett is offline
Registered User
  
 

Join Date: Jan 2002
Posts: 60
Question Renaming a file name

I have an audit log that is produced each day from a production printer. It names the file using todays date, but it removes the leading zero's. For example: todays date 060104 names the file 6104.txt.

I ftp this file onto a Sun box and pull stats off of it. To keep some consistency to what I am doing I would like to rename the file from 6104.txt to 060104.txt, i.e. inserting zero if the day and month are single digits. Can anyone help me do this, please?

Thanks in advance
  #2 (permalink)  
Old 01-06-2004
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
Not enough information remains to solve the problem.

011104 becomes 11104
110104 becomes 11104

Given 11104, which choice do we select?
  #3 (permalink)  
Old 01-06-2004
oombera's Avatar
oombera oombera is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2002
Location: Cleveland, OH
Posts: 804
You could name the file as soon as it's created or ftp'd... Assuming it's the only text file in the directory, on ksh:

mv *.txt `date +%d%m%y`.txt
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 -4. The time now is 11:20 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0