#!/usr/bin/perl

@files = `ls -1 sample.txt` ;
chomp @files ;

foreach $file (@files) {
    my @lines = `cat $file` ;
    $file =~ s/.txt//;
    open (FILE, "> $file.txt2" );
    foreach $line (@lines) {
	($item, $desc, $number, $price) = split (/	/, $line) ;
	print FILE ($item, "	", $desc, "	", $price, "	", $number, "\n");
    }
    close FILE ;
    mv $file.txt $file.orig;
    mv $file.2 $file ;
}
