Results 1 to 2 of 2
Hi,
I am trying to run a command on matlab installed on windows in which I run a awk statement which is interpreted by cygwin.
When I run the whole ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 12-17-2010 #1Just Joined!
- Join Date
- Oct 2008
- Posts
- 11
matlab issue: linux vs windows
Hi,
I am trying to run a command on matlab installed on windows in which I run a awk statement which is interpreted by cygwin.
When I run the whole statement under linux, it executes without anyy problem but when the statement is exected under cygwin, I get an error message.
Here is the statement with error:
tempfile = '../tmp/junk';
system(sprintf('awk ''{if( NF>23) print $4;}'' ../tmp/naive1_short.txt > %s ', tempfile));
Error:
gawk: {if( NF print $4;}
gawk: ^ syntax error
Somehow it fails to interpret GREATER THAN sign.
Anyone having some idea?
Thanks,
Abhi.
- 12-19-2010 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,160
Try enclosing the statement in single instead of double quotes. Since they are already inside a single-quoted string, escape them with backslashes. IE:
Also, you may need to put a space before+after the curly braces { and }.Code:system(sprintf('awk \'{if( NF>23) print $4;}\' ../tmp/naive1_short.txt > %s ', tempfile));Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote
