#!/bin/env perl use strict; use warnings; use File::Basename; my $headerSep=$ARGV[0]; my $txtFile=$ARGV[1]; my $fileid =basename($txtFile); $fileid=~ s/\./-/g; open(my $fh, '<', $txtFile) or die "Could not open file '$txtFile' $!"; print "\n
";
my $i=1;
while (my $row = <$fh>) {
chomp $row;
if ($row =~ /^$headerSep/) {
print "\n";
$row =~ s/$headerSep//g;
print "";
$i++;
next;
}
print "$row\n" unless $row =~ /^\s*$/;
}
print "\n";
close $fh;