Alois Schlögl schrieb:
> It would be nice, if developers aiming at compatibility between octave
> and matlab could feel at home here.
> 
> I looked also at David's suggestion to use oct2mat.
> 
> line 188:     gsub("[\\]$","...");
> caused this error:
> awk: /home/schloegl/matlab/oct2mat/oct2mat: line 188: regular expression
> compile failed (bad class -- [], [^] or [)

Hi Alois,

the behavior of Gawk's sub, gsub, gensub functions has changed, I expect 
oct2mat 
uses the old style, to replace the Octave style "\" into Matlab style "..." at 
the end of lines. It's important how many "\\\\\\..." you take, cf. the GNU awk 
user manual. The solution for your problem here is 4 ;) You also can remove the 
braces "[]" here because they don't make any sense for me (am I wrong?). Your 
line should look like

   gsub ("\\\\$", "...");

BTW, here is my test line

   $ awk --version
   GNU Awk 3.1.6

   $ awk '{ gsub ("\\\\$", "..."); print }' testfile.txt
   printf ("Some Octave ...
   code. And here is even\n...
   more code");

with the contents of testfile.txt

   $ cat testfile.txt
   printf ("Some Octave \
   code. And here is even\n\
   more code");

Best regards,

   Thomas

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to