Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Edit an space dlimted file from excel

Status
Not open for further replies.

skatun

Programmer
Oct 16, 2008
5
DE
I want to add @]@[ before each cell in excel how can do this with perl. I almost got it to work!! It worked fine with comma except then all my white spaces are gone...

Code:
$filename = "Bok1.prn";
$filename2 = "bok2.txt";
open ( FILE, $filename) or die "Cannot open file: $!";
print "file open for editing\n";
while ( $line = <FILE> ) {
    
    $line =~ s/^(.*)/\@\[$1/;
    $line =~ s/^(.*)/$1\@\]/;
    $line =~ s/ /\@\]\@\[ /ig; # here is the problem..
    push(@outLines, $line);
}
 
close FILE;
 
open ( OUTFILE, ">$filename2" );
print ( OUTFILE @outLines );
close ( OUTFILE );
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top