The UNIX and Linux Forums  

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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
List to columns and awk help baghera Shell Programming and Scripting 17 08-28-2007 05:20 AM
Row to Columns vskr72 UNIX for Dummies Questions & Answers 4 03-21-2007 06:53 AM
How can I use columns with a command? chrchcol Shell Programming and Scripting 0 07-24-2006 04:51 PM
re arrange the columns ahmedwaseem2000 Shell Programming and Scripting 0 09-22-2005 11:51 PM
adding columns Kelam_Magnus Shell Programming and Scripting 9 01-25-2002 07:35 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-20-2005
tonet
Guest
 

Posts: n/a
Smile add columns with awk

hi everybody:
My question is how could i add a new columns to a file that it has one column like this:
06/06/2005
06/07/2005
06/08/2005
06/09/2005
06/10/2005
06/11/2005
06/12/2005
06/13/2005
06/14/2005
06/15/2005
06/16/2005
06/17/2005
....
And i want add columns like :

06/06/2005 file1 file2 file3 .....
06/07/2005 file1 file2 file3 .....
06/08/2005 file1 file2 file3 .....
06/09/2005 file1 file2 file3 .....
06/10/2005 file1 file2 file3 .....
06/11/2005 file1 file2 file3 .....
06/12/2005 ................
06/13/2005 ................
06/14/2005 ................
06/15/2005 ................
06/16/2005 ................
06/17/2005 ................
...... ................
with awk.
Thanks in advance
Reply With Quote
Forum Sponsor
  #2  
Old 06-20-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
nawk '{print $0, "file1 file2 file3"}' myFile
Reply With Quote
  #3  
Old 06-20-2005
tonet
Guest
 

Posts: n/a
Talking

when i put file1, this mean that this field comes from other file, and file2 from other.
i want add columns, and these new columns come from other file.
thanks
Reply With Quote
  #4  
Old 06-20-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
look into 'man paste'
Reply With Quote
  #5  
Old 06-21-2005
Registered User
 

Join Date: Feb 2005
Location: Coimbatore, Tamilnadu, India
Posts: 119
You can use getline utility with awk program as,

awk '{ getline ln < "file1"; print ln" "$0 }' file

hth.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:54 AM.


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 Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0