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
Adding columns to a file figaro UNIX for Dummies Questions & Answers 5 07-20-2008 10:50 PM
add columns from file to another and sort kamel.seg Shell Programming and Scripting 12 12-12-2007 11:39 AM
How can i replace certain columns in the file mani_um Shell Programming and Scripting 6 06-22-2007 07:40 AM
how to get the columns name and fields from this file. rnallamothu Shell Programming and Scripting 15 06-13-2007 05:14 AM
Appending columns on a file abel Shell Programming and Scripting 2 09-27-2002 04:04 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-02-2007
Registered User
 

Join Date: Sep 2007
Posts: 23
have a file with 300 columns

I am using awk to split the file to have 255 columns data in one file and rest in another file.
This is the script i am using

awk -F"|" '{print > $240}' sourcefilename> targetfilename

Since, I cannot import the data into excel sheet , as excel sheet accepts only 255 columns, I am trying to do this. Please help me in this matter where i am trying to insert a flat file with "$" as the delimiter into the excel sheet . But after 255 columns its truncating data.Please suggest me.

Thanks in advance

Last edited by dummy_needhelp; 11-02-2007 at 01:33 PM.
Reply With Quote
Forum Sponsor
  #2  
Old 11-02-2007
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,294
awk may not be able to do what you want, most awk implementations limit the number of fields there can be in a single record. Some have limits as low as 100 fields. And unix utilities all have limits as to the maximum line length.

Consult your awk man page.

You may have to resort to perl or python.
Reply With Quote
  #3  
Old 11-03-2007
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,610
something like this

Code:
my @arr = split(/\|/);

for( my $i = 0; $i < $#arr; $i++ ) {
  if ( $i <= 240 ) {
    <print in to the current file>
  }
  else {
    <print  another file>
  }
}
Reply With Quote
  #4  
Old 11-04-2007
Registered User
 

Join Date: Sep 2007
Posts: 23
Can you please give a clear code. Thank you
Reply With Quote
  #5  
Old 11-04-2007
Yogesh Sawant's Avatar
Part Time Moderator and Full Time Dad
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 791
you can use Spreadsheet::WriteExcel module in perl to create well formatted excel sheets.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
awk, perl

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:40 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 Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0