From: Ethan A M. <merritt@u.washington.edu> - 2008-03-31 14:32:44
|
On Monday 31 March 2008 04:02, pl...@pi... wrote: > Hi, > > I appear to have hit a limitation on setting up a command string for > system command. I have a "simple" bash command line that works in a > terminal: > > bash-3.2#tail -n1 "../htdocs/data/adc.data"| awk 'format= " c3=%g\n > c4=%g\n c5=%g\n" {printf format,$3,$4,$5}' >temps.tmp > bash-3.2#cat temps.tmp > c3=1.796 > c4=1.676 > c5=2.788 > > However, when I try to replicate this from within gnuplot is seems not to > get correct send to awk > > > system "tail -n1 '../htdocs/data/adc.data'| awk 'format= \" c3=%g\n > c4=%g\n c5=%g\n\" {printf format,$3,$4,$5}' >temps.tmp " > > awk throws an error back to gnuplot: > > gnuplot> load "control.gnu" > awk: format= " c3=%g > awk: ^ unterminated string > > > For some reason it seems not to see the second \" No. The error message is exactly correct; the problem is that the carriage return (\n) immediatedly after the c3=%g is terminating the awk command. It is safer to define a complex string in single quotes rather then double quotes. > I have tried to rearrange this in different ways but it always seems to > hit the same root cause. > > Is this a possible bug in the parser? > > Thx, Peter. > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > _______________________________________________ > gnuplot-beta mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-beta > -- Ethan A Merritt |