MathGroup Archive 2007

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

Search the Archive

Re: comments in import files

  • To: mathgroup at
  • Subject: [mg74663] Re: comments in import files
  • From: rob <josh2499 at>
  • Date: Fri, 30 Mar 2007 02:58:58 -0500 (EST)
  • References: <eudd45$sdc$> <eufr25$7rm$>

Hi, I spent some time in the Help looking for "grep". It is 
listed is several places and appears to be associated with 
FindList. But I never found a single instance of the term 
"grep" mentioned anywhere after reading thru many pages.

Can you please give me some clue what it is? Thanks.

Szabolcs wrote:
> On Mar 28, 11:39 am, "beheiger" <beheiger at> wrote:
>>I would like to know if Mathematica can handle comments in import files.
>>In particular, I would like to add lines of comments to an
>>ASCII table (say, "results.dat") that I produced with other programs.
>>I can't seem to find anything on how to write these comments in such a way
>>Mathematica's function, used as
>>does not complain. Help is appreciated.
>>Regards, Andy
> If nobody else posts a better solution (I hope that someone will), you
> can use the grep program to strip out the comments, e.g.
> readTable[filename_] := (Run["grep", "-v", "^#", filename, ">", "c:\
> \temp\\tmpfile"]; Import["tmpfile", "Table"])
> (This will remove lines starting with #.)
> Of course you can also use Mathematica to read the file line by line
> and strip out the comments, but it may be slow with large datasets.

  • Prev by Date: Re: Which Mathematica product
  • Next by Date: Re: Re: Multi-core Support in Mathematica 5.2
  • Previous by thread: Re: comments in import files
  • Next by thread: Re: comments in import files