Hello

        You can use (split //) to get the characters of a string.  

    @fields = split //, $line;
    printf sortcode "\n%6.6s%8.8s%27.27s%35.35s%35.35s", @fields[0..2,4..6];
        # instead of
$fields[0],$fields[1],$fields[2],$fields[4],$fields[5],$fields[6];
    }

Hope this helps

Aziz,,,


On Mon, 9 Jul 2001 15:08:13 +0100 , Govinderjit Dhinsa said:

>       Hi, can any body help me with a regex problem that I have please!
>       #########################################
>       Q. Could any body please show me how to, print data by searching
>  character Numbers in a input line!
>       #########################################
>       I have a input file, below is a few *LINES* of example of the input
>  file:
>  
>       168127407932117187M000001080m200107035eN/A
>       168148007947033647M200107015m2100000000n/a
>  
>       168149807947023347M000200107m0000034500n/a
>       168150607947058268M200107015y13 00000000n/a
>       #######################################################
>       For each *line* of the input file I need to get certain sets of data
>  in the line (string), for example;
>       0 to 5 (characters), 8 to 12 (characters), 14 to 16 (characters on
>  each line)
>  
>       *I can only search by specifying numbers* as there is no, spaces,
>  tabs and etc, to separate the fields that I require!
>  
>       ########################################################
>       Here is a programme that I wrote in the past to search for Fields,
>  as there was tab spaces in-between the input file, fields. I would like to
>  modify this programme to do what I need, however I can not use this as there
>  is no tab spaces to separate the fields in the input file!
>  
>       open iscd,"<$ARGV[0]" or die "Cannot open $ARGV[0]",$!;
>       open sortcode,">$ARGV[1]";
>       while($line=<iscd>){
>               chomp $line;
>               @fields=split "\t",$line;
>               printf sortcode "\n%6.6s%8.8s%27.27s%35.35s%35.35s",
>       
>  $fields[0],$fields[1],$fields[2],$fields[4],$fields[5],$fields[6];
>       }
>       close iscd;
>       close sortcode;
>       exit;
>       #######################################################
>  
>       Any help would be much appreciated.
>  
>       Kind Regards 
>       GD
>  


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Reply via email to