Sponsored Content
Full Discussion: parsing
Top Forums UNIX for Dummies Questions & Answers parsing Post 302112234 by dennis.jacob on Tuesday 27th of March 2007 12:38:13 AM
Old 03-27-2007
Here is a solution , give a try on this...

Code:
cat filename | tr -d "( )" | tr "=>" ", " | awk -F"," '{ if($2=="0") head=$3" ="; if ($2=="1") print head $3>"file1";if ($2=="2") print  head $3>"file2"; }'

Output
cat file1
heading1 = value1.1a
heading2 = value1.1b
heading3 = value1.1c
heading4 = value1.1d
cat file2
heading1 = value2.1a
heading2 = value2.1b
heading3 = value2.1c
heading4 = value2.1d

Last edited by dennis.jacob; 03-27-2007 at 01:46 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parsing Binary

I have a binary file a particular format. It contains the Length Bytes and the Type bytes i.e the first four bytes if the file indicate the length of the Type which is to follow. for eg, if the int value of the first four bytes is 80, then it means that the length of the following "Type" is 80.... (2 Replies)
Discussion started by: xgringo
2 Replies

2. Shell Programming and Scripting

Need some help with parsing

I have a big xml file with little formatting in it. It contains over 600 messages that I need to break each message out in its own separate file. The xml file looks in the middle of it something like this: </Title></Msg><Msg><Opener> Hello how are you?<Title> Some says hello</Title><Body>... (3 Replies)
Discussion started by: quixoticking11
3 Replies

3. Shell Programming and Scripting

Perl parsing compared to Ksh parsing

#! /usr/local/bin/perl -w $ip = "$ARGV"; $rw = "$ARGV"; $snmpg = "/usr/local/bin/snmpbulkget -v2c -Cn1 -Cn2 -Os -c $rw"; $snmpw = "/usr/local/bin/snmpwalk -Os -c $rw"; $syst=`$snmpg $ip system sysName sysObjectID`; sysDescr.0 = STRING: Cisco Internetwork Operating System Software... (1 Reply)
Discussion started by: popeye
1 Replies

4. Shell Programming and Scripting

Parsing of file for Report Generation (String parsing and splitting)

Hey guys, I have this file generated by me... i want to create some HTML output from it. The problem is that i am really confused about how do I go about reading the file. The file is in the following format: TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Discussion started by: umar.shaikh
8 Replies

5. Shell Programming and Scripting

iterative parsing

I have always struggled when parsing a file vertically vs. by line horizontally. Can't seem to get my head around the concept. Here again I need to convert vertical output to horizontal output. original output root@acuransx:bpplsched 2000-STAND3 -v -M acuransx -l <2>bpplsched: INITIATING:... (4 Replies)
Discussion started by: jouuu
4 Replies

6. Shell Programming and Scripting

Need help with parsing a file

I trying to get only the highest version of the file names from an file which has list of file names. EX: CATEGORYDISPLAY JSP.A-SRC_BLD;2.4 CATEGORYDISPLAY JSP.A-SRC_BLD;2.5 CATEGORYDISPLAY JSP.A-SRC_BLD;2.1 CATEGORYDISPLAY JSP.A-SRC_BLD;2.2 The Script should display only the highest... (7 Replies)
Discussion started by: rocker_me2002
7 Replies

7. Shell Programming and Scripting

Parsing through Awk

Hi All, I have an input file something like this: Line1 Line2 .... LineN Identifier ( Field1a, Field1b; Field2a, Field1b; Field3a, Field1b; ..... ) LineN+1 LineN+2 etc.. I basically need Field1a, Field2a, Field3a.... from the above file (6 Replies)
Discussion started by: tostay2003
6 Replies

8. Shell Programming and Scripting

sed (parsing value)

All, Can somebody provide me with some sed expertise on how to parse the following line. 27-MAR-2011 10:28:01 * (CONNECT_DATA=(SID=dmart)(CID=(PROGRAM=sqlplus)(HOST=mtasnprod1)(USER=mtasnord))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.197.7.47)(PORT=54881)) * establish * dmart * 0 I would like... (3 Replies)
Discussion started by: BeefStu
3 Replies

9. Shell Programming and Scripting

Parsing the file

Hi all, Could anyone help me out? My input file is like: M1SYSNPENGGQINDNINYSE21PTMLPENLSLSNYDMDSFLGQFPSDNNMQLPHSTYEQHLQGEQQNPTNPNYFPPEFDEN2VDW1QE2 output is: M1 M1SYSNPENGGQINDNINYSE2 M1SYSNPENGGQINDNINYSE21 SYSNPENGGQINDNINYSE2 SYSNPENGGQINDNINYSE21 ... (2 Replies)
Discussion started by: yinyuemi
2 Replies

10. Shell Programming and Scripting

parsing

Can some body show me a sed command to remove everyhing upto a '/' and leave the rest of the line. cat data.out This is the directory /tmp/xxx/yy.ksh I only want to get the fullpath name /tmp/xxx.yy.ksh Thanks in advance to all who answer. (3 Replies)
Discussion started by: BeefStu
3 Replies
XML::Stream::Namespace(3pm)				User Contributed Perl Documentation			       XML::Stream::Namespace(3pm)

NAME
XML::Stream::Namespace - Object to make defining Namespaces easier in XML::Stream. SYNOPSIS
XML::Stream::Namespace is a helper package to XML::Stream. It provides a clean way of defining Namespaces for XML::Stream to use when connecting. DESCRIPTION
This module allows you to set and read elements from an XML::Stream Namespace. METHODS
SetNamespace("mynamespace"); SetXMLNS("http://www.mynamespace.com/xmlns"); SetAttributes(attrib1=>"value1", attrib2=>"value2"); GetNamespace() returns "mynamespace" GetXMLNS() returns "http://www.mynamespace.com/xmlns" GetAttributes() returns a hash ( attrib1=>"value1",attrib2=>"value2") GetStream() returns the following string: "xmlns:mynamespace='http://www.nynamespace.com/xmlns' mynamespace:attrib1='value1' mynamespace:attrib2='value2'" EXAMPLES
$myNamespace = new XML::Stream::Namespace("mynamspace"); $myNamespace->SetXMLNS("http://www.mynamespace.org/xmlns"); $myNamespace->SetAttributes(foo=>"bar", bob=>"vila"); $stream = new XML::Stream; $stream->Connect(name=>"foo.bar.org", port=>1234, namespace=>"foo:bar", namespaces=>[ $myNamespace ]); # # The above Connect will send the following as the opening string # of the stream to foo.bar.org:1234... # # <stream:stream # xmlns:stream="http://etherx.jabber.org/streams" # to="foo.bar.org" # xmlns="foo:bar" # xmlns:mynamespace="http://www.mynamespace.org/xmlns" # mynamespace:foo="bar" # mynamespace:bob="vila"> # AUTHOR
Written by Ryan Eatmon in February 2000 Idea By Thomas Charron in January of 2000 for http://etherx.jabber.org/streams/ Currently maintained by Darian Anthony Patrick. COPYRIGHT
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2010-01-08 XML::Stream::Namespace(3pm)
All times are GMT -4. The time now is 10:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy