mohammed chafik wrote: > Hi all, > > 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, please > note that number of those fields is variable): > ---------------------------------------------------------------------------- ------- > header, 06-12-2004, path, /usr/bin/sh, subject,bscs,sgrp,9936,6785,0 > 0,return,success,0 (line1) > ... 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 Show us your program if you want more help than that :~) HTH -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>