help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Specific fixed width question...


From: CdeMills
Subject: Re: Specific fixed width question...
Date: Wed, 15 Sep 2010 01:30:04 -0700 (PDT)


forkandwait wrote:
> 
> Two lines of example data (notice that the county field (#4) is 25
> characters
> wide and that spaces are used both between fields like WA and 053 and
> between
> parts of the county name, so you can't just split on spaces):
> 
> WA 053 011 Clark County             45
> WA 053 027 Grays Harbor County      100
> 
> I would like to parse out cntys=[11; 27] and data=[45; 100] from the
> above.
> 
> I realize that I can pre-process the file outside of Octave, but I don't
> want to
> for various reasons (lack of access to real Unix tools, mostly).
> 
> 

 regexp('WA 053 011 Clark County             45 ', '\d+', 'match')
ans =

{
  [1,1] = 053
  [1,2] = 011
  [1,3] = 45
}

Could it be more simple ? 

Regards

Pascal
-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/Specific-fixed-width-question-tp2539259p2540113.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]