The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


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
Help in adding positive & negative values in a column berlin_germany Shell Programming and Scripting 4 02-09-2007 01:03 PM
FILE:Adding new column sandeep_hi Shell Programming and Scripting 2 06-09-2006 06:46 AM
Adding a column of numbers Khoomfire UNIX for Advanced & Expert Users 1 01-18-2006 12:55 AM
adding a column at the end of the record pavan_test UNIX for Dummies Questions & Answers 2 11-07-2005 07:39 AM
Changing the column for a row in a text file and adding another row aYankeeFan Shell Programming and Scripting 9 05-02-2005 06:42 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-20-2008
Registered User
 

Join Date: Jan 2007
Posts: 27
Adding a date as a first column

I want to add a date to a record which is appended to a file that gets its data from an external source. An explanation:

1. Getting external data: curl http://www.example.com/temperatures.txt

2. Getting the required record: | grep mylocation

3. Appending to file: >> mytemperatures.txt

The question is not only to append the temperatures, but to add a column with the current date and time. So I need to add something like "$( date +%Y%m%d%H%M%S )" as the first column to mytemperatures.txt. How is this done?

Thanks in advance
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-20-2008
Registered User
 

Join Date: Apr 2008
Location: European Union/Germany
Posts: 183
(echo -n `curl http://www.example.com/temperatures.txt | grep mylocation` ; date +param) >> mytemperatures.txt
Reply With Quote
  #3 (permalink)  
Old 05-21-2008
Registered User
 

Join Date: Jan 2007
Posts: 27
Thanks, that worked. How do I add a tab character between the columns, notably the grepped data and the date?
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:08 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0