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 extract date with time from file prash_b Shell Programming and Scripting 5 06-18-2008 08:30 AM
Extract Monday from given date itsme_maverick UNIX for Advanced & Expert Users 2 05-29-2008 04:15 AM
extract date skumar11 Shell Programming and Scripting 3 09-12-2007 10:59 PM
extract date portion from file misenkiser Shell Programming and Scripting 5 10-06-2006 05:37 AM
Extract century from date (Solaris platform) u449064 SUN Solaris 1 02-09-2006 01:34 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 09-29-2007
magi magi is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 2
Extract Date from file

I am new to unix scripting. we are using bash. My task is I have dir which contains 30 files.

The first column in each file is Date field. For all the files I need to extract
the date part Ex(2007-09-05) from the file and add that at the end of that file.

for example:

The file names are like test.txt,test1.txt,test2.txt

it need to be changed as test_2007-09-05.txt etc.

test.txt

Date Source Location Point count
2007-09-05 15:31:46 Phone Dallas 100 864
2007-09-05 15:31:46 Email Dallas 1000 514



test1.txt
Date Source Location Point count
2007-09-05 15:31:46 Phone Atlanta 100 864
2007-09-05 15:31:46 Email Atlanta 1000 514



test2.txt

Date Source Location Point count
2007-09-05 15:31:46 Phone Arizona 100 864
2007-09-05 15:31:46 Email Arizona 1000 514



Can you please paste any sample script.

Thanks for help,

mag
 

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 09:53 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