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
How to get a filename modified by attaching modified timestamp Ruks Shell Programming and Scripting 16 06-03-2009 08:46 AM
conversion of different timestamp to standard timestamp dprakash Shell Programming and Scripting 2 04-14-2009 02:23 PM
gzcat into awk and then change FILENAME and process new FILENAME timj123 Shell Programming and Scripting 6 06-23-2008 07:45 AM
add timestamp to filename walterja Shell Programming and Scripting 3 11-09-2005 12:42 AM
how to add a timestamp to a filename? Optimus_P UNIX for Dummies Questions & Answers 2 05-25-2001 12:47 PM

Reply
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 1 Week Ago
Reddy482 Reddy482 is offline
Registered User
  
 

Join Date: Nov 2009
Posts: 15
Timestamp in the filename

Hi
i want to replace the previous time stamp with the current timsatp at the start of the file like

20090710_113354_FT0710a.txt this one to 20091111__113354_FT0710a.txt

thanks in advance
  #2 (permalink)  
Old 1 Week Ago
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,291
What have you tried?
  #3 (permalink)  
Old 1 Week Ago
Scrutinizer Scrutinizer is online now
Registered User
  
 

Join Date: Nov 2008
Posts: 584
Try this:
Code:
$> fn=20090710_113354_FT0710a.txt
$> echo "$(date +%Y%m%d)_${fn#*_}"
20091111_113354_FT0710a.txt
  #4 (permalink)  
Old 1 Week Ago
learnbash learnbash is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 96
Quote:
Originally Posted by Reddy482 View Post
Hi
i want to replace the previous time stamp with the current timsatp at the start of the file like

20090710_113354_FT0710a.txt this one to 20091111__113354_FT0710a.txt

thanks in advance
Greetings,

You need to use touch command with -t switch.

-t STAMP
use [[CC]YY]MMDDhhmm[.ss] instead of current time

if you want to update with current time then -> touch filename.
Sponsored Links
Reply

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 10:49 PM.


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