hi,
i have a file that contains ID, Name, Start, End, Circular and Function. I just need ID and Name. i use below script and it works.
#!/usr/bin/perl
open (MYFILE, '>scaffold_1.txt');
select (MYFILE);
open (FILE, 'scaffold_11.txt');
while (<FILE>)
{
chomp;
my @fields = split /\|/;
my @output = grep /^(ID|NAME)/, @fields;
print join("\t", @output), "\n";
}
close (FILE);
exit;
but it gives me output with lots of blank spaces. How can i get output like below?
ID PHCHR1_10
NAME PHCHR1_10
ID PHCHR1_100
NAME PHCHR1_100
ID PHCHR1_1000
NAME PHCHR1_1000
also, how to get output with tab within it like below?
PHCHR1_10 PHCHR1_100 PHCHR1_1000
thanks..
i have a file that contains ID, Name, Start, End, Circular and Function. I just need ID and Name. i use below script and it works.
#!/usr/bin/perl
open (MYFILE, '>scaffold_1.txt');
select (MYFILE);
open (FILE, 'scaffold_11.txt');
while (<FILE>)
{
chomp;
my @fields = split /\|/;
my @output = grep /^(ID|NAME)/, @fields;
print join("\t", @output), "\n";
}
close (FILE);
exit;
but it gives me output with lots of blank spaces. How can i get output like below?
ID PHCHR1_10
NAME PHCHR1_10
ID PHCHR1_100
NAME PHCHR1_100
ID PHCHR1_1000
NAME PHCHR1_1000
also, how to get output with tab within it like below?
PHCHR1_10 PHCHR1_100 PHCHR1_1000
thanks..