|
From: Ethan M. <merritt@u.washington.edu> - 2005-06-15 21:36:51
|
On Wednesday 15 June 2005 09:43 am, Lutz Maibaum wrote: > > I was wondering if it would be feasible to include shell-like wildcard > expansion into gnuplot. For example > plot "a.*.dat" > > Is it possible to do this in a platform-independent way? I currently use the > little script "pl" (http://www.phys.uni-paderborn.de/~stern/pl/) to use the > globbing features of the shell, but there are quite a few things that would > be much easier to do in an interactive gnuplot session. With the bleeding-edge cvs patch from Juergen Wieferink to implement a system() call, you could use a similar perlscript to do something along the lines of: set macros file_list = system("ls -1 a.*.dat | dirlist.pl") plot @file_list where dirlist.pl is a cleaned up version of this quick perl hack (which leaves a missing " at the start of the line and an extra ," at the end, but you get the idea) #!/usr/bin/perl -w while (<>) { s/\n/", "/; print; } In fact, if you use the equally bleeding-edge substring manipulation code you can do the cleanup inside gnuplot. The following actually works when run in the source directory using yesterday's cvs version with Juergen's patch: set macros file_list = system("ls -1 ../demo/?.dat | ./dirlist.pl") file_list = "\"".file_list file_list = file_list[0:strlen(file_list)-4] plot @file_list -- Ethan A Merritt merritt@u.washington.edu Biomolecular Structure Center Mailstop 357742 University of Washington, Seattle, WA 98195 |