[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Specific fixed width question...
From: |
fork |
Subject: |
Re: Specific fixed width question... |
Date: |
Tue, 14 Sep 2010 23:39:20 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Judd Storrs <jstorrs <at> gmail.com> writes:
>
> sscanf can extract formatted text well. e.g.:
>
> sscanf("WA 053 011 Clark County 45","%*2c %*3d %3d %*25c %d")
> sscanf("WA 053 027 Grays Harbor County 100,"%*2c %*3d %3d %*25c %d")
>
> You can use fscanf to read the whole file:
>
> fid = fopen("data.txt") ;
> data = fscanf(fid,"%*2c %*3d %3d %*25c %d\n",[2,inf]) ;
> fclose(fid) ;
> cntys = data(1,:).' ;
> data = data(2,:).' ;
This works, but I find it hard to generalize. So I just used emacs macros and
kill-rectangle to edit a whole bunch of files -- the amount of my life spent
removing human readable formatting from data is amazing....
Thanks to all
> --judd
>
- Specific fixed width question..., fork, 2010/09/14
- Re: Specific fixed width question..., Sergei Steshenko, 2010/09/14
- Re: Specific fixed width question..., Judd Storrs, 2010/09/14
- Re: Specific fixed width question...,
fork <=
- Specific fixed width question..., John W. Eaton, 2010/09/14
- Re: Specific fixed width question..., CdeMills, 2010/09/15
- Re: Specific fixed width question..., fork, 2010/09/15
- Re: Specific fixed width question..., CdeMills, 2010/09/16
- Re: Specific fixed width question..., John W. Eaton, 2010/09/16
- Re: Specific fixed width question..., Sergei Steshenko, 2010/09/16
- Re: Specific fixed width question..., CdeMills, 2010/09/16
- Re: Specific fixed width question..., Sergei Steshenko, 2010/09/16