The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-16-2008
figaro figaro is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 271
Adding columns to a file

I want to select the first column from a daily file called foo.csv. The result is written to file foo.txt. Currently the following script is used for that:
cut -d, -f 1 foo.csv > foo.txt

A typical result would yield :
A12
A45
B11
B67

What needs to happen in addition is that two columns need to be added before writing to file, namely a code (say 'abc') and the current date, such that a typical result would yield :
abc 2008-05-20 A12
abc 2008-05-20 A45
abc 2008-05-20 B11
abc 2008-05-20 B67

How can this be achieved in particular if the date (column 2) should be today's date?

Last edited by figaro; 05-16-2008 at 05:37 PM.. Reason: Simplification of problem