0

I am correcting the boundary box of a test.eps file produced with gnuplot with the following awk shell command within a gnuplot program:

! awk '{ if($1=="%%BoundingBox:"){left=$2-90; print left;  bottom=$3-69;   print   bottom; right=$4+8; print right; top=$5+5; print top; print $1, left, bottom, right, top >> "1.txt"}\
 else {print $0 >> "1.txt"} }' test.eps
! mv 1.txt test.eps

Under linux this works perfectly well. If I now run exactly the same command under windows using the gnuwin command awk it does not work, but produces an empty file 1.txt and correspondingly also an empty test.eps What goes wrong?

user299563
  • 19
  • 1
  • The only way that script can produce an empty output file is if the input file was empty (or awk couldn't open it or couldn't write to the output file). Check your input file contents and output directory/file permissions and look for error messages. You do know that Windows has completely different quoting rules from UNIX though, right? Start with a print Hello World script to make sure you've got that right at least. – Ed Morton Apr 30 '18 at 14:29
  • I'm not familiar with gnuwin: what shell are you running in it? – glenn jackman Apr 30 '18 at 14:40
  • @Ed Morton: the input file test.eps is not empty; in linux the command works very well and does what it is meant to do: to increase the bounding box. Thanks for your comment on quoting rules. Where can I find anything on that? – user299563 Apr 30 '18 at 15:10
  • 2
    google it but the usual advice is to put your script in a file and run it as `awk -f scriptfile inputfile` to avoid the nightmare of Windows quoting rules all together. That's assuming that whatever `gnuwin` is it using Windows quoting rules and it's not providing a UNIX-like environment. Personally I'd just install and use cygwin. – Ed Morton Apr 30 '18 at 15:48

0 Answers0