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 > 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 05:03 PM
FILE:Adding new column sandeep_hi Shell Programming and Scripting 2 06-09-2006 09:46 AM
Adding a column of numbers Khoomfire UNIX for Advanced & Expert Users 1 01-18-2006 04:55 AM
adding a column at the end of the record pavan_test UNIX for Dummies Questions & Answers 2 11-07-2005 11: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 09:42 PM

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 05-20-2008
figaro figaro is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 267
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
  #2 (permalink)  
Old 05-20-2008
fabtagon fabtagon is offline
Registered User
  
 

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

Join Date: Jan 2007
Posts: 267
Thanks, that worked. How do I add a tab character between the columns, notably the grepped data and the date?
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 04:35 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