[ale] Another Large File/PERL/Awk/Sed question...

JK jknapka at kneuro.net
Tue Dec 1 16:25:01 EST 2009


sed -e '0,1 s/column4;column4/column4;column5/' < hugeFile > resultFile

-- JK


Bob Kruger wrote:
> All;
> 
> Thanks to all who assisted me with my earlier question on deleting the semicolon from the end of a line.  I have another one that may be a bit stickier.
> 
> Again I have a large data file in text format, this one is 3.2GB.  Same as before, the field are semicolon delimited.  The first line of the file is the column name.  However, I have two columns that were inadvertently given the same column name.  
> 
> Example:
> 
> column1;column2;column3;column4;column4;column6;column7....
> 
> I would like to change the second instance of column4 to column5 on the first line of the file.  I thought it would be simple to fire up vi and just do a simple text edit.  The edit part was simple, but the saving of the file is taking hours.
> 
> Any thoughts or ideas using PERL, Awk, or Sed?
> 
> Thanks in advance for any assistance.
> 
> V/r
> 
> Bob
> 
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
> 
> 



More information about the Ale mailing list