help-octave
[Top][All Lists]
Advanced

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

Re: preventing an empty last line in text files produced by dlmwrite


From: Shelleyb
Subject: Re: preventing an empty last line in text files produced by dlmwrite
Date: Sun, 13 May 2007 20:13:40 -0700 (PDT)

Hi,

Yes, my OS is Windows and I installed Cygwin before using Octave.

I tried grep -v ^$ <data.dat >data1.dat at the Octave command prompt, and
only received an error message about syntax (invalid character "$" (ASCII
36)).

I tried the same in the Cygwin shell, and there were no syntax errors, but
the data1.dat file generated still had a blank line at the end.

I reinstalled grep from the Cygwin setup, but this did not help.

Have you had success using 'grep' within Octave? Is there another package
that I need to install in order to get it to work. Maybe the syntax in
Octave is wrong.

Thanks!


avraham wrote:
> 
> On Sun, May 13, 2007 at 05:06:33PM +0200, Shelley Brown wrote:
>> Hi,
>> 
>> I am trying to create a text file based on experimental data. 
>> 
>> The text file must not have any header lines or an empty line at the end
>> of the file.
>> 
>> The following code prevents any header lines, but I still have an empty
>> line at the end of the file which I need to suppress.
>> 
>> dlmwrite('C:/data.dat',data,' ',0,0,'newline','unix')
>> 
>> I would appreciate it if anyone has any suggestions about how to overcome
>> the problem.
>> 
>> /Shelley
>> 
>>  
>> 
> 
>> _______________________________________________
>> Help-octave mailing list
>> address@hidden
>> https://www.cae.wisc.edu/mailman/listinfo/help-octave
> Hi,
> Judging by your 'C:/data.dat', I guess that your operating system
> is MS-Windows and that you have installed cygwin, before/in order to
> installing octave.
> If this is so, you most probably have the utility "grep" (if not,
> you can download it from the cygwin site). You can use it to filter 
> out the empty lines, using the command:
> grep -v ^$ <data.dat >data1.dat
> in the directory in which you created data.dat
> Translated in plain English: grep=select, -v=invert selection,
> ^$=line containing nothing between beginning and end (empty
> line), <data.dat=from the file data.dat, >data1.dat=to the file
> data1.dat
> Good luck, Avraham
> -- 
> Please avoid sending to this address attachments in excess of 2MByte, 
> or any Excell or Powerpoint attachments.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
> 
> 

-- 
View this message in context: 
http://www.nabble.com/preventing-an-empty-last-line-in-text-files-produced-by-dlmwrite-tf3735514.html#a10530422
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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