[Thread Prev][Thread Next][Index]

Re: [ferret_users] spawn command gawk string arrays



Hi Patrick,
                      I do not know if below method suites your actual requirement but it works for  your example
yes? list {spawn: 'echo Hello ferreters | cut -f1 -d" " '}
or yes? let  A= {spawn: 'echo Hello ferreters | cut -f1 -d" " '}
here fno is the field number and d" " is the delimiter of the field

Sudheer

On Wed, Mar 24, 2010 at 4:46 PM, Brockmann Patrick <Patrick.Brockmann@xxxxxx> 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




--
with best regards

Sudheer

**********************************************************************************
Sudheer Joseph                                                                  
Scientist                                                                                    
Indian National Centre for Ocean Information Services (INCOIS)    
Ocean Valley, Post Box No# 21,
IDA Jeedimetla P.O.                  
Hyderabad, Ranga Reddy District - 500 055
Andhra Pradesh, India.
TEl:+91-40-23044600(R),Tel:+91-9440832534(Mobile)
Tel:+91-40-23886047(O),Fax:+91-40-23892910(O)
E-mail:sjo@xxxxxxxxxxxxxx; sudheer.joseph@xxxxxxxxx;  sjo@xxxxxxxxxxxxx.
Web- http://oppamthadathil.tripod.com
          --------------* ---------------
"The ultimate measure of a man is
not where he stands in moments of
comfort and convenience, but where
he stands at times of challenge and
controversy."
                       Martin Luther King, Jr.
"What we have done for ourselves alone dies with us.
What we have done for others and the world remains and is immortal."
- Albert Pines

[Thread Prev][Thread Next][Index]

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

Privacy Policy | Disclaimer | Accessibility Statement