The UNIX and Linux Forums  

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
Reading columns in tab delimited file net Shell Programming and Scripting 2 02-18-2009 08:01 AM
Merging Non-Empty Columns within a CSV mmann1123 UNIX for Dummies Questions & Answers 2 12-03-2008 07:40 PM
Need Help for Adding Three new columns in existing file from fatching data from file Sandeep_Malik Shell Programming and Scripting 36 09-17-2008 06:12 PM
Adding columns to a file figaro UNIX for Dummies Questions & Answers 5 07-21-2008 02:50 AM
Perl: adding columns in CSV file with information in each dolo21taf Shell Programming and Scripting 1 03-05-2008 02:52 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 02-27-2009
Banni Banni is offline
Registered User
  
 

Join Date: Feb 2009
Location: Denmark
Posts: 8
Adding EMPTY columns to Tab-delimited txt file

Hi

I have a txt file with 4 columns where I need to add 4 empty columns in the middle meaning that I need what is currently column 4 to be column 8 in a new file.

The idea is that I have to use the file as input in a program that reads the data in column 1 and 8, so the content of the other columns doesn't matter.

I am a total newbie but have tried something like:

gawk '{print $1,"\t ","\t ","\t ","\t " , $2 , $3 , $4}' filename.txt > test

And this adds space between the original columns 1 and 2 but apparently this doesn't qualify as being columns but just "space".

I keep getting the following error when running my program(and there's nothing wrong with that command because it works with a file with the correct number of columns):

READING HLA POPULATION COVERAGE FILE:test
Traceback (most recent call last):
File "/home/people/lunde/python/popcover6_HLAonly.py", line 349, in ?
HLAcoverindex, popcoverlist = readpop(open(opts.coveragefilename, 'r'))
File "/home/people/lunde/python/popcover6_HLAonly.py", line 105, in readpop
coverage = float(fields[7])
IndexError: list index out of range

Hope someone can help me out. Please!
 

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 08:37 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