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: Avraham Rosenberg
Subject: Re: preventing an empty last line in text files produced by dlmwrite
Date: Sun, 13 May 2007 21:57:04 +0300
User-agent: Mutt/1.5.9i

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.


reply via email to

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