----- Original Message -----
From: "Chris Charley" <[EMAIL PROTECTED]>
To: <beginners@perl.org>
Sent: Tuesday, August 05, 2008 10:45 PM
Subject: Re: question about text operation using regex.
----- Original Message -----
From: ""Remy Guo"" <[EMAIL PROTECTED]>
Newsgroups: perl.beginners
To: "Perl Beginners" <beginners@perl.org>
Sent: Tuesday, August 05, 2008 10:14 PM
Subject: question about text operation using regex.
hi all,
i have a txt log file and i want to delete the 9th character of each
line.
how can i do it using regex?...thanks!
-Remy
Ooops. Sent it to the poster by mistake.
You could do it from the command line
perl -pe "8 < length && substr $_,8, 1, ''" logfile.txt > altered_file.txt
Chris
Just to clarify the substr function here. Following the 1, are 2 *single*
quotes. This assigns the empty dtring to the 9th position of the string,
effectively eliminating the 9th character.
Chris
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/