Re: extraction of info from fixed position




Quoth "Rose" <rose@xxxxxxxx>:
Instead of specifying in detail (e.g. d+d+...) in a regular expression, is
it possible to specify some fixed numbers for perl to extract information,
in this example, S, 95 from line 1; 'space',42 from line2 and 'T',156 from
line3 in the following 3 lines?

46 51 V S S- 0 0 95 -2,-0.9 -7,-0.2 -6,-0.2
2,-0.1 -0.899 75.7-167.1-103.3 112.1 10.3 5.4 11.8

If I've understood you correctly, that's what substr is for.

Ben

.



Relevant Pages

  • extraction of info from fixed position
    ... Instead of specifying in detail in a regular expression, ... it possible to specify some fixed numbers for perl to extract information, ... line3 in the following 3 lines? ...
    (comp.lang.perl.misc)
  • RE: Optimization for faster select...
    ... Although its a cute idea to create a function based index on SUBSTR ... I tried to see whether the SUBSTR could be replaced with Perl formatting ... the possibility of writes delaying the extract. ... So, ladies and gets, everything comes down to using RowCacheSize attribute. ...
    (perl.dbi.users)
  • Re: Time Complexity for substr() function
    ... :Is it under linear time? ... perl knows the length of strings. ... substr() is thus constant-time with respect to the length of the ...
    (comp.lang.perl.misc)
  • Strange problem with substr() function and right aligned fields
    ... I must process the output of an SQL query using Perl. ... However, for some strange reason, the Perl substr() function is unable ... Extending the field boundary to the right has no ...
    (perl.beginners)
  • Re: substr()
    ... in dem ich einen Showcase fuer die ... Anfang August wurde ein Fehler in Perl mit substr, ...
    (de.comp.lang.perl.misc)