I'm trying to merge several .ktf tracks files for Kartex. It's suppose to take the first file in a directory, and append the other files to it, excluding the header.
This is what a .ktf file looks like:I've come up with the following code://Kartex TrackFil skapad av Kartex 5.4 &KTF 2.0,sweref 99 lat long,1 %,0,N59°3.577' E13°2.460',53.97,2009-09-16 10:05:38,,,$ %,1,N59°3.577' E13°2.460',55.89,2009-09-16 10:05:41,,,$ %,2,N59°3.579' E13°2.457',55.41,2009-09-16 10:05:45,,,$ %,3,N59°3.581' E13°2.432',55.41,2009-09-16 10:06:02,,,$ %,4,N59°3.579' E13°2.422',56.37,2009-09-16 10:06:09,,,$ %,5,N59°3.579' E13°2.417',56.37,2009-09-16 10:06:13,,,$
This takes the first line of every file, excluding the header, and merges them into D:\mergedfile.ktf. I was thinking I could add the header to the file later manually. How do I best get it to take everything following the header:use File::Find; my $dir = Cwd::getcwd(); find(\&wanted,$dir); sub wanted { if ($_ != /\.ktf$/) { print "$File::Find::name"; open (GPXDATA, "$File::Find::name") || die("Could not open fil +e! $File::Find::name"); my(@raw_data)=<GPXDATA>; open (MYFILE, '>>D:\mergedfile.ktf'); for (@raw_data) { print MYFILE m"(%,0,.+)"mgs } close (MYFILE); } }
Until the end of the file? And merge it into one file?//Kartex TrackFil skapad av Kartex 5.4 &KTF 2.0,sweref 99 lat long,1
In reply to Match multiple lines by WeeDie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |