![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 |
| Display Modes | Rate This Thread |
|
|