problems iterating in RUBY while extracting info from YAML, Pls help!
Hi all,
I am stuck with a ruby script that extracts detials from yaml file and processes accordingly.
the yaml file
the ruby script
The o/p i get is like this
but the yaml file has 2 names ,"confivnic" and "notsoconfi"
This was written originally for just one module but for obvious reasons we had to change it. I tried all i knew but really not finding a way out.
The things that i feel are creating errors are yaml.keys.first
or the way iteration is done.
The o/p i want is similar to the shown one but instead of repeating the same one twice i want the other one to be displayed as well with the necessary changes.
Ok heres the situation,
We use Solaris 8 at work with Sybase for the db. I need to be able to easily create visual diagrams of some of our more complex systems. I've been using Visio which is such a manual process and takes a while.
I was thinking maybe using Visio somehow in conjunction... (0 Replies)
i have a file that contain lines like this
9.4.7.8.5.7.9.0.5.7.1.2.msisdn.sub.cs. 1 IN CNAME SDP01.cs.
there are about 50,000 lines like this in the files i want to the extract the digits from the above line like:-
947857905712
OS Solaris9 (3 Replies)
Hello all,
my unix is bash based and the finger command output is:
Login Name Tty Idle LoginTime Office
amos.john Amos John pts/26 1 Dec 5 16:18 (77.100.22.07)
What am trying to achieve is extract the Login (amos.john) and Name (Amos John) from this output without using awk or sed.
... (1 Reply)
Hi everyone,
I'm trying to extract the user name and full name from the finger command without using sed or awk.
Any pointers?
Thanks in advance. (6 Replies)
Here is a data file, which I believe is in YAML. I am trying to retrieve just the 'addon_domains" section, which doesnt seem to be as easy as I had originally thought. Any help on this would be greatly appreciated!! I have been trying to do this in awk and mostly bash scripting instead of perl... (3 Replies)
Hi all,
I have two .txt file i.e.
First text file:
2
4
1
4
Second text file
2 1.nii.gz
4 334.nii.gz
1 12.nii.gz
4 134.nii.gz
If entry in 1st column of 1st text file matches the 1st column of 2nd text file, then copy the file (name of which is the second column) associated with... (4 Replies)
I'm just getting my feet wet with web development, so hopefully this is a simple thing I'm overlooking, but so far I'm stumped.
I have a php script that calls Ruby via exec(). This works fine in my test environment, but when I moved it to my production environment I run into a permissions... (7 Replies)
Hello,
I am very new to solaris so please bear with me. I have 2 machines in question. For both I am trying to get the HBA Card Hardware information such as:
HBA Model Name
HBA Firmware version
HBA Port details
HBA Driver details
First machine is a Solaris 10. When I execute fcinfo... (6 Replies)
how to extract user machine name for current terminal using finger command
below command gives machinename for all session , is it possible to filter it to only currernt terminal ?
finger -b -p $LOGNAME | grep from (12 Replies)
i have a text file which i am generating from few sqls.
format is like :
col1 col2 col3 col4 col5
1001 DONE ABC 17-sep-14 12:02:05
1001 DONE ABC 17-sep-14 12:02:05
1001 DONE ABC 17-sep-14 12:02:55
1001 REDONE ABC ... (6 Replies)
Discussion started by: deepakiniimt
6 Replies
LEARN ABOUT MOJAVE
yaml
yaml(n) YAML processing yaml(n)
__________________________________________________________________________________________________________________________________________________NAME
yaml - YAML Format Encoder/Decoder
SYNOPSIS
package require Tcl 8.4
package require yaml ?0.3.5?
::yaml::yaml2dict ?options? txt
::yaml::yaml2huddle ?options? txt
::yaml::setOption ?options?
::yaml::dict2yaml dict ?indent? ?wordwrap?
::yaml::list2yaml list ?indent? ?wordwrap?
::yaml::huddle2yaml huddle ?indent? ?wordwrap?
_________________________________________________________________DESCRIPTION
The yaml package provides a simple Tcl-only library for parsing the YAML http://www.yaml.org/ data exchange format as specified in
http://www.yaml.org/spec/1.1/.
The yaml package returns data as a Tcl dict. Either the dict package or Tcl 8.5 is required for use.
COMMANDS
::yaml::yaml2dict ?options? txt
::yaml::yaml2huddle ?options? txt
Parse yaml formatted text txt into a Tcl dict/huddle and return the value.
-file txt is a filename of YAML-stream.
-stream
txt is just a YAML-stream.
-types list
The list is a type list for the yaml-scalar types.(e.g. !!str !!timestamp !!integer !!true ...)
-types {timestamp integer null true false}
In this case, if a string matched "timestamp", converted to the TCL internal timestamp.(e.g. "2001-12-15T02:59:43.1Z" =>
1008385183)
-m:true param
The param is two elements of list for the value of true, and considered strings.
-m:true {1 {true on + yes y}}
In this case, the string "yes" found in YAML Stream, automatically converted 1.
-m:false param
The param is two elements of list for the value of false, and considered strings.
-m:false {0 {false off - no n}}
-m:null param
The param is two elements of list for the value of null, and considered strings.
-m:null {"" {null nil "" ~}}
-validate
Experiment,old: Output stream contains YAML's-tag, each node.
% puts [::yaml::load -validate {[aaa, bbb]}]
=>
!!seq {{!!str aaa} {!!str bbb}}
::yaml::setOption ?options?
Change implicit options for the library. Now, the params are the same as ::yaml::yaml2dict. Arguments of::yaml::yaml2dict is more
priority than this setting.
::yaml::dict2yaml dict ?indent? ?wordwrap?
::yaml::list2yaml list ?indent? ?wordwrap?
::yaml::huddle2yaml huddle ?indent? ?wordwrap?
Convert a dict/list/huddle object into YAML stream.
indent spaces indent of each block node. currently default is 2.
wordwrap
word wrap for YAML stream. currently default is 40.
EXAMPLES
An example of a yaml stream converted to Tcl. A yaml stream is returned as a single item with multiple elements.
{
--- !<tag:clarkevans.com,2002:invoice>
invoice: 34843
date : 2001-01-23
bill-to: &id001
given : Chris
family : Dumars
address:
lines: |
458 Walkman Dr.
Suite #292
city : Royal Oak
state : MI
postal : 48046
ship-to: *id001
product:
- sku : BL394D
quantity : 4
description : Basketball
price : 450.00
- sku : BL4438H
quantity : 1
description : Super Hoop
price : 2392.00
tax : 251.42
total: 4443.52
comments:
Late afternoon is best.
Backup contact is Nancy
Billsmer @ 338-4338.
}
=>
invoice 34843 date 2001-01-23 bill-to {given Chris family Dumars address {lines {458 Walkman Dr.
Suite #292
} city {Royal Oak} state MI postal 48046}} ship-to {given Chris family Dumars address {lines {458 Walkman Dr.
Suite #292
} city {Royal Oak} state MI postal 48046}} product {{sku BL394D quantity 4 description Basketball price 450.00} {sku BL4438H quantity 1 description {Super Hoop} price 2392.00}} tax 251.42 total 4443.52 comments {Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.}
An example of a yaml object converted to Tcl. A yaml object is returned as a multi-element list (a dict).
{
---
- [name , hr, avg ]
- [Mark McGwire, 65, 0.278]
- [Sammy Sosa , 63, 0.288]
-
Mark McGwire: {hr: 65, avg: 0.278}
Sammy Sosa: { hr: 63, avg: 0.288}
}
=>
{name hr avg} {{Mark McGwire} 65 0.278} {{Sammy Sosa} 63 0.288} {{Mark McGwire} {hr 65 avg 0.278} {Sammy Sosa} {hr 63 avg 0.288}}
LIMITATIONS
tag parser not implemented. currentry, tags are merely ignored.
Only Anchor => Aliases ordering. back alias-referring is not supported.
Too many braces, or too few braces.
Not enough character set of line feeds. Please use only "
" as line breaks.
BUGS, IDEAS, FEEDBACK
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category yaml of
the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for
either package and/or documentation.
SEE ALSO
base64, huddle, json
KEYWORDS
data exchange, huddle, parsing, text processing, yaml
COPYRIGHT
Copyright (c) 2008 KATO Kanryu <kanryu6@users.sourceforge.net>
yaml 0.3.5 yaml(n)