[Thread Prev][Thread Next][Index]

Re: [ferret_users] spawn command gawk string arrays



Hi,
I agree that some of string processing can be done with ferret string functions but gawk
provides much more than this.

My example was trying to explain how a "unclosed quotation, parenthesis, or bracket" makes impossible a use of gawk within a spawn command to define a string array.

I think that is nice when softwares have a "permeability zone" and for instance
system commands calls can be done.
It is too bad to let all gawk features gone because of a parsing problem.

Patrick

I guess that like Ned, I'd use Ferret's string handling functions to process the string, rather than a call to awk.

  let instring = {spawn:"echo Hello ferreters"}
  let ns = STRINDEX (instring, " ")
  let a = SUBSTRING(instring, `ns+1`, `strlen(instring)`)

The string functions are listed here,
http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/handing-string-data-symbols/STRING-FUNCTIONS

Ansley

Brockmann Patrick wrote:
Hi all,

Is there a simple way to use gawk through the spawn command and get the result in string array ?

Example:

in shell
$ echo Hello ferreters |  awk '{print $2}'

in ferret
yes? spawn echo Hello ferreters | awk '{print $2}'

But how to get the result in a string array like

yes? LET a = {spawn:"ls *.nc"}
yes? LIST a

yes? let A = {spawn:"echo Hello ferreters | awk '{print $2}'"}
**ERROR: command syntax: {spawn:"echo Hello ferreters | awk '{print $2}'"}
         unclosed quotation, parenthesis, or bracket

Up to now, I have used a trick by passing by an external shell script like:
let A = {spawn:"echo Hello ferreters | awk -f get_2nd.awk"}

but that is not as easy as it could be.
Could the syntax parsing of the spawn command be changed ?

Patrick




--
LSCE/IPSL, Laboratoire CEA-CNRS-UVSQ
Data Analysis and Visualization Engineer
IPSL Global Climate Modelling Group
mailto:Patrick.Brockmann@xxxxxx
01.69.08.32.24 --> LSCE (Orme des merisiers 712, Bureau 11)
http://www.ipsl.jussieu.fr/~brocksce/
--



[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement