Hello!
Does somebody know how to print the following fields from these lines
chr1 166851489 166851564
chr1 166851665 166851740

so that Perl prints only:
chr1 166851489 166851740
All fields are tab-separated.


Thank you.
/Rob

Also furthering to what KevinADC has already mentioned what is the criteria that you want to print values on ? We can't figure from two values which values you want to print and which ones you just need to ignore.

Also furthering to what KevinADC has already mentioned what is the criteria that you want to print values on ? We can't figure from two values which values you want to print and which ones you just need to ignore.

Thanks for replying.
I would like to print the first value from the first line following by the last value from the second line. There are many lines, but Perl must consider them as pairs, (first 2 lines, ad then next two, ...). I stuck on this jumps between the pairs of lines.

chr 1 166851489 166851740

Thank you.

Oh For The Sake Of Pete:

#!/usr/bin/perl

$filepath = "./file.dat";

# Get Data From File Into Arrays
open (FH, "$filepath");
	while (<FH>) {
		($stamp, $part1, $part2) = split(/\s+/);
		push @stamps, $stamp;
		push @parts1, $part1;
		push @parts2, $part2;
	}
close (FH);

$array_size = @stamps;

for ($i=0; $i < $array_size; $i++) {
	print "$stamps[$i] $parts1[$i] $parts2[++$i]\n";
}
This article has been dead for over six months. Start a new discussion instead.