MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: importing fixed width data

  • To: mathgroup at smc.vnet.net
  • Subject: [mg97595] Re: importing fixed width data
  • From: Rob Mayoff <mayoff at gmail.com>
  • Date: Mon, 16 Mar 2009 04:26:02 -0500 (EST)
  • References: <gpg1lt$cps$1@smc.vnet.net>

On Mar 14, 5:42 am, swiftset <swift... at gmail.com> wrote:
> Hi, I'm trying to import data from a file where the fields are stored
> in a fixed width format.

In[65]:= input="09349489John           Jones            123 Main St
\n09349490Phil             Hayes            7 Cross Rd\n";
In[66]:= fields={{1,8},{9,23},{24,40},{41,-1}};
In[67]:= StringTrim/@StringTake[ImportString[input,"List",Numeric-
>False],fields]
Out[67]= {{09349489,John,Jones,123 Main St},{09349490,Phil,Hayes,7
Cross Rd}}



  • Prev by Date: Re: Two Notebooks Open at the Same Time
  • Next by Date: Re: Trouble with FullSimplify
  • Previous by thread: Re: importing fixed width data
  • Next by thread: Re: importing fixed width data