Hi Thomas
File editing is particularly easy in perl.
Herez some sample code to get you started :
----------------------------------------------------------------------------
------------------------------
@ARGV='C:\Documents and Settings\athind\Desktop\test\File2Edit.txt'; # path
to the file you want to edit
$^I=".bak"; # this will be appended to the original filename
and will act as BackUp.
while (<>)
{
s/!//; # will replace ! with nothing i.e. all instances of
! will be removed.
s/SUB-TOTAL://; # same as above for SUB-TOTAL:
print; # writes the new file line by line
}
----------------------------------------------------------------------------
--------------------------------
Try this on the file you want to edit.
Anything else you want to edit\replace can be done by the
s/what2replace/bywhat2replace/;
-aman
-----Original Message-----
From: Thomas Browner [mailto:thomas.browner@;digidyne.com]
Sent: Wednesday, November 13, 2002 7:33 PM
To: [EMAIL PROTECTED]
Subject: file editting
I there away to edit a file in perl? This is what is I am trying to do.
I have a file that I want to remove some content. This is an example of
a line:
! 6134.21 3200 SUB-TOTAL: M:\alvin
I want to remove the ! and SUB-TOTAL. I hope some one can tell me an
simple way of doing this sine I am a new to perl.
Thank you,
Thomas
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]