help-octave
[Top][All Lists]
Advanced

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

Re: Skipping comments in load files


From: Mike Miller
Subject: Re: Skipping comments in load files
Date: Wed, 6 Oct 2004 11:41:07 -0500 (CDT)

On Tue, 5 Oct 2004, Dmitri A. Sergatskov wrote:

Mike Miller wrote:
On Tue, 5 Oct 2004, Joe Koski wrote:

I figured out my problem. The particular file that I picked to try as an example had a single space on the last "blank" line of the file.



As I just wrote, the problem appears to be not with blank, tab or space, but with other non-printable characters.
[snip]
At least I cannot reproduce the problem using all kind of combinations of linefeed, tab, space. I tried ^L, ^F, and ^Z and it brakes with any of them.

It might appear that I ignored your message, but I started to write it before your response came in, and after I'd sent it, I saw that you had replied. I can update my reply in response to your message by showing a perl script that works like the last one I recommended but it will leave white space alone and only remove ^L, ^F, and ^Z:


---begin script on next line-----
#!/usr/bin/perl -i -p
s/[\cF\cL\cZ]//g
---end script on previous line-----


In perl, the \cL represents ^L (control-L), \cZ represents ^Z, and so on. So you could alter the script to remove any control characters you wanted to remove. It would do it quickly on large collections of files specified using wildcard characters. This can also be done without a script on the command line like this, for example:

perl -pi -e 's/[\cF\cL\cZ]//g' *.txt

I hope that helps someone out there.

Mike



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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