Hmmm...if the missing column is always after "syntenic," you could try something akin to this:
#/usr/bin/perl
use strict;
use warnings;
while(<DATA>) {
chomp;
my @rec = split(/\s+/, $_);
$rec[4] .= "\t" if(scalar(@rec) == 9);
print join("\t", @rec)."\n";
}
__DATA__
MGI:1918918 381629 0610007C21Rik 5 syntenic 51374 C2orf28 2p23.3 B
MGI:1918917 71667 0610007L01Rik 5 syntenic F 55069 C7orf42 7q11.21 C
MGI:1923501 76251 0610007P08Rik 13 syntenic B3 375748 C9orf102 9q22.32
+ M
MGI:1915571 58520 0610007P14Rik 12 syntenic 11161 C14orf1 14q24.3 B
which is presuming that "syntenic" is element 4 (counting from 0) and records including something like
"syntenic B3" split into 10, vs 9, columns. The if test just adds a tab to "syntenic" when the record splits into 9, vs 10, columns.
Information about American English usage here and here. Floating point issues? Please read this before posting. — emc
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.