Bob Showalter wrote:
mohammed chafik wrote:
I have input file like this:
------------------------------------------------------------------------
header, 06-12-2004, path,
/usr/bin/sh,attribute,100555,root,other,315,565690,
subject,bscs,sgrp,9936,6785,0 0,return,success,0 (line1)
...
I need to generate an output file like this (deleting fields
between attribute and subject,
I would take the input line and split on comma into an array.
It looks like you want to keep the first 4 elements, and then shift
the element starting with subject over into the fifth slot. Am I
right?
I'd just call splice() in a loop to remove one element at a time
until 'subject' slides into the fifth element. Then you're done.
perldoc -f split
perldoc -f splice
I'd use the m// operator:
/(.+)attribute.+( subject.+)/s
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>