Sponsored Content
Top Forums Shell Programming and Scripting Parsing file, yaml file? Extracting specific sections Post 302279450 by vgersh99 on Thursday 22nd of January 2009 05:36:21 PM
Old 01-22-2009
something along these lines - assuming ''somedomain-s' are indented with spaces.

nawk -f rh.awk myYAMLfile

rh:awk:
Code:
BEGIN {
   FS=RS=""
}
$1 == "addon_domains:"{
   for(i=2; $i ~ /^  */; i++)
      print substr($i, 1, index($i, ":")-1)
}

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parsing file and extracting the useful data block

Greetings All!! I have a very peculiar problem where I have to parse a big text file and extract useful data out of it with starting and ending block pattern matching. e.g. I have a input file like this: sample data block1 sample data start useful data end sample data block2 sample... (5 Replies)
Discussion started by: arminder
5 Replies

2. UNIX for Dummies Questions & Answers

Is extracting specific files from a zip file possible?

If a zip file contains several zip files, but if the file names of the files needed are known, is there a variation of the unzip command that will allow those few (individual) files to be extracted? --- Example: Zip file name: zip.zip unzip -l zip.zip will display file01, file02, file03, etc.... (1 Reply)
Discussion started by: HLee1981
1 Replies

3. Programming

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 confivnic: device: vnic1: policy: - L2 mode: active vnic2: policy: - L3 - L4 mode: active type: aggr ... (1 Reply)
Discussion started by: wrapster
1 Replies

4. Shell Programming and Scripting

Extracting specific text from a file

Dear All, I have to extract a a few lines from a log file and I know the starting String and end string(WHich is same ). Is there any simplere way using sed - awk. e.g. from the following file -------------------------------------- Some text Date: 21 Oct 2008 Text to be extracted... (8 Replies)
Discussion started by: rahulkav
8 Replies

5. Shell Programming and Scripting

SED 4.1.4 - INI File Change Problem in Variables= in Specific [Sections] (Guru Help)

GNU sed version 4.1.4 on Windows XP SP3 from GnuWin32 I think that I've come across a seemingly simple text file change problem on a INI formatted file that I can't do with SED without side effects edge cases biting me. I've tried to think of various ways of doing this elegantly and quickly... (5 Replies)
Discussion started by: JakFrost
5 Replies

6. Shell Programming and Scripting

extracting specific lines from a file

hi all, i searched in unix.com and accquired the following commands for extracting specific lines from a file .. sed -n '16482,16482p' in.sql > out.sql awk 'NR>=10&&NR<=20' in.sql > out.sql.... these commands are working fine if i give the line numbers as such .. but if i pass a... (2 Replies)
Discussion started by: sais
2 Replies

7. Shell Programming and Scripting

Extracting content from a file in specific format

Hi All, I have the file in this format **** Results Data **** Time or Step 1 2 20 0.000000000e+00 0s 0s 0s 1.024000000e+00 Us 0s 0s 1.100000000e+00 1s 0s 0s 1.100000001e+00 1s 0s 1s 2.024000000e+00 Us Us 1s 2.024000001e+00 ... (7 Replies)
Discussion started by: diehard
7 Replies

8. UNIX for Advanced & Expert Users

Extracting specific lines from data file

Hello, Is there a quick awk one-liner for this extraction?: file1 49389 text55 52211 text66 file2 59302 text1 49389 text2 85939 text3 52211 text4 13948 text5 Desired output 49389 text2 52211 text4 Thanks!! (5 Replies)
Discussion started by: palex
5 Replies

9. Shell Programming and Scripting

YAML file update

removing post since it got fix (1 Reply)
Discussion started by: kishore150
1 Replies

10. UNIX for Dummies Questions & Answers

Help on parsing Oracle RMAN output for string and print sections of a file

Hi, I need some advise on how to print 'sections' of the attached file. I am searching for some that says Marked Corrupt and print some lines after it. At the moment I am running the command below: sed -n -e '/Marked Corrupt/{N;N;p;}' rman_list_validate.txtThis gives me the following... (1 Reply)
Discussion started by: newbie_01
1 Replies
KWALIFY(1)							   User Commands							KWALIFY(1)

NAME
kwalify - Tiny schema validator for YAML and JSON SYNOPSIS
kwalify [-h | --help | -v] kwalify [-s] [-t] [-l] [-E] -f schema.yaml doc.yaml [doc2.yaml ...] kwalify [-s] [-t] [-l] [-E] -m schema.yaml [schema2.yaml ...] kwalify [-s] [-t] [-l] [-E] {-a action | -ha action} -f schema.yaml [schema2.yaml ...] DESCRIPTION
kwalify validates schema file, or YAML / JSON file against a schema. OPTIONS
-h --help Show summary of options. -v Display version information. -s Be silent. -t Expand tab characters. -l Show linenumber when errored (experimental). -E Show errors in emacs-style (implies '-l'). -m schema.yaml Meta-validation mode: validate schema.yaml. -f schema.yaml Schema definition file: validate file against schema.yaml. -a action Generate code (depending on action: 'genclass-ruby' or 'genclass-java'). -ha action Generate code (depending on action: 'genclass-ruby' or 'genclass-java') with properties. doc.yaml File to validate. AUTHOR
Marc `Duck` Dequenes <Duck@DuckCorp.org> Original author. COPYRIGHT
Copyright (C) 2007-2011 Marc Dequenes (Duck) This manual page was written for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 3 or any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License version 3 can be found in /usr/share/common-licenses/GPL-3. Kwalify 2011-09-16 KWALIFY(1)
All times are GMT -4. The time now is 11:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy