Extracting fields from a data file

From: Mohammed Chafik (chafik_at_mail.com)
Date: 06/29/04


To: beginners@perl.org
Date: Tue, 29 Jun 2004 10:04:08 -0500

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)

header, 06-12-2004, path, /usr/bin/sh,attribute,100555,dba,5, subject,bscs,sgrp,9936,6785,0 ,return,success,0 (line2)

header, 06-12-2004, path, /usr/bin/sh,attribute,100555,tom,other,315,56,11,54,77,10,88, subject,bscs,sgrp,9936,6785,0 0,return,success,0 (line3)
-----------------------------------------------------------------------

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)

header, 06-12-2004, path, /usr/bin/sh, subject,bscs,sgrp,9936,6785,0 0,return,success,0 (line 2)

header, 06-12-2004, path, /usr/bin/sh, subject,bscs,sgrp,9936,6785,0 0,return,success,0 (line 3)
-----------------------------------------------------------------------------------
Thanks a lot ,

CHAFIK

-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm


Relevant Pages

  • Re: Extracting fields from a data file
    ... > I have input file like this: ... > I need to generate an output file like this (deleting fields between ... Asking for free solutions ...
    (perl.beginners)
  • Re: Help is needed to compile C program using Visual Studie 2005
    ... the pdb file that was used when this precompiled header was created, ... an output file whose name has the following format: ... The length of input file paths and name must be less than 256; ... while(i < DefinedVariableArrayIndex) { ...
    (microsoft.public.vc.language)
  • Re: Need advice on File I/O
    ... open the input file and open an output file, ... you would still have the input file unchanged. ... On all currently supported operating systems, ...
    (comp.soft-sys.matlab)
  • Re: Help with pattern matching
    ... then print the line to an output file. ... > replica of the input file. ... In Perl, CamelBack is generall reserved for package names. ... where their meaning must be expressed in comments. ...
    (perl.beginners)
  • Re: Help with pattern matching
    ... then print the line to an output file. ... > replica of the input file. ... If you had had warnings enabled as well as strict you might have found ... > # Assign the second field to an evaluation scalar ...
    (perl.beginners)