Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

RE: eliminate some characters inside a file

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34723] RE: [mg34716] eliminate some characters inside a file
  • From: "Annetts, Dave (E&M, North Ryde)" <David.Annetts at csiro.au>
  • Date: Mon, 3 Jun 2002 01:46:43 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

> this is my question: I´ve got a large numbers o files with the next
> appearance:
> 
> "12,56,12,14"
> "13,56,25,36"
> "14,58,465,7"
>     .
>     .
>     .
> 
> and I need Mathemathica to eliminate " " and changes , by 
> blank space to
> obtain the next:
> 12 56 12 14
> 13 56 25 36
> 14 58 465 7
>     .
>     .
>     .
> If anybody can help me I would be very pleased

Read the file into a list of strings, then StringReplace[#, {","->" "}]& ...

However, if you're going to do this with a large number of files, you might
be better off with a stream editor such as sed.  And perhaps a better
suggestion is to correct it at the source, if at all possible.

Regards,

Dave.
--------------------------------------------------------
  Dr. David Annetts             EM Modelling Analyst
  Tel: (+612) 9490 5416         CSIRO DEM, North Ryde
  Fax: (+612) 9490 5467         David.Annetts at csiro.au
                 Include "usual_disclaimers"
--------------------------------------------------------



  • Prev by Date: Failures (?) in Limit[f[x,y],x->x0]
  • Next by Date: Re: repeated entries in File>Palettes menu (again)
  • Previous by thread: Re: eliminate some characters inside a file
  • Next by thread: RE: eliminate some characters inside a file