Sponsored Content
Top Forums Shell Programming and Scripting awk : Filter a set of data to parse header line and last field of multiple same match. Post 302763857 by rveri on Wednesday 30th of January 2013 02:38:15 PM
Old 01-30-2013
awk : Filter a set of data to parse header line and last field of multiple same match.

Hi Experts,

I have a data with multiple entry , I want to filter PKG= & the last column "00060110" or "00088150" in the output


file:
Code:
###############################################################################################
PKG= P8SDB     :: VGS = vgP8SOra vgP8SDB1 vgP8S001 vgP8S007 vgP8S003 vgP8S004 vgP8SOlog 
PKG= P8SDB    disks:                    
-----------------------------------------------------------------------------------------------
/dev/rdisk/disk7777   xx  00   00  xxxx  07:67  xxxx 00060110
/dev/rdisk/disk7737   xx  00   00  xxxx  02:03  xxxx 00060110
/dev/rdisk/disk7741   xx  00   00  xxxx  07:65  xxxx 00060110
/dev/rdisk/disk7744   xx  00   00  xxxx  07:68  xxxx 00060110
/dev/rdisk/disk7745   xx  00   00  xxxx  07:66  xxxx 00060110
/dev/rdisk/disk7746   xx  00   00  xxxx  07:64  xxxx 00060110
/dev/rdisk/disk7750   xx  00   00  xxxx  07:63  xxxx 00060110
/dev/rdisk/disk7751   xx  00   00  xxxx  02:00  xxxx 00060110
/dev/rdisk/disk7753   xx  00   00  xxxx  02:07  xxxx 00060110
/dev/rdisk/disk7754   xx  00   00  xxxx  07:67  xxxx 00060110
/dev/rdisk/disk7755   xx  00   00  xxxx  02:01  xxxx 00060110
----------------------------------------------------------------------------------------------
###############################################################################################
PKG= P9SDB     :: VGS = vgP9SOra vgP9SDB1 vgP9S001 vgP9S007 vgP9S003 vgP9S004 vgP9SOlog 
PKG= P9SDB    disks:                    
-----------------------------------------------------------------------------------------------
/dev/rdisk/disk7778   xx  00   00  xxxx  06:67  xxxx 00088150
/dev/rdisk/disk7739   xx  00   00  xxxx  03:03  xxxx 00088150
/dev/rdisk/disk7742   xx  00   00  xxxx  06:65  xxxx 00088150
/dev/rdisk/disk7743   xx  00   00  xxxx  06:68  xxxx 00088150
/dev/rdisk/disk7745   xx  00   00  xxxx  06:66  xxxx 00088150
/dev/rdisk/disk7747   xx  00   00  xxxx  06:64  xxxx 00088150
/dev/rdisk/disk7758   xx  00   00  xxxx  06:63  xxxx 00088150
/dev/rdisk/disk7752   xx  00   00  xxxx  03:00  xxxx 00088150
/dev/rdisk/disk7759   xx  00   00  xxxx  03:07  xxxx 00088150
/dev/rdisk/disk7751   xx  00   00  xxxx  06:67  xxxx 00088150
/dev/rdisk/disk8755   xx  00   00  xxxx  03:01  xxxx 00088150
----------------------------------------------------------------------------------------------




The output to be look like:

Code:
PKG= P8SDB     :: VGS = vgP8SOra vgP8SDB1 vgP8S001 vgP8S007 vgP8S003 vgP8S004 vgP8SOlog   :: 00060110
PKG= P9SDB     :: VGS = vgP9SOra vgP9SDB1 vgP9S001 vgP9S007 vgP9S003 vgP9S004 vgP9SOlog   :: 00088150

Thanks a lot,
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

AWK: Pattern match between 2 files, then compare a field in file1 as > or < field in file2

First, thanks for the help in previous posts... couldn't have gotten where I am now without it! So here is what I have, I use AWK to match $1 and $2 as 1 string in file1 to $1 and $2 as 1 string in file2. Now I'm wondering if I can extend this AWK command to incorporate the following: If $1... (4 Replies)
Discussion started by: right_coaster
4 Replies

2. UNIX for Dummies Questions & Answers

Command line / script option to filter a data set by values of one column

Hi all! I have a data set in this tab separated format : Label, Value1, Value2 An instance is "data.txt" : 0 1 1 -1 2 3 0 2 2 I would like to parse this data set and generate two files, one that has only data with the label 0 and the other with label -1, so my outputs should be, for... (1 Reply)
Discussion started by: gnat01
1 Replies

3. Shell Programming and Scripting

awk Help: Filter Multiple Entry & print in one line.

AWK Gurus, data: srvhcm01 AZSCI srvhcm01 AZSDB srvhcm01 BZSDB srvhcm01 E2QDI31 srvhcm01 YPDCI srvhcm01 YPDDB srvhcm01 UV2FSCR srvhcm01 UV2FSBI srvhcm01 UV2FSXI srvhcm01 UV2FSUC srvhcm01 UV2FSEP srvhcm01 UV2FSRE srvhcm01 NASCI srvhcm01 NASDB srvhcm01 UV2FSSL srvhcm01 UV2FSDI (7 Replies)
Discussion started by: rveri
7 Replies

4. Shell Programming and Scripting

awk Parse And Create Multiple Files Based on Field Value

Hello: I am working parsing a large input file which will be broken down into multiples based on the second field in the file, in this case: STORE. The idea is to create each file with the corresponding store number, for example: Report_$STORENUM_$DATETIMESTAMP , and obtaining the... (7 Replies)
Discussion started by: ec012
7 Replies

5. Shell Programming and Scripting

Command/script to match a field and print the next field of each line in a file.

Hello, I have a text file in the below format: Source Destination State Lag Status CQA02W2K12pl:D:\CAQA ... (10 Replies)
Discussion started by: pocodot
10 Replies

6. Shell Programming and Scripting

awk parse result that match data from file

i run command that return this result,example : gigabitethernet2/2/4:NotPresent, gigabitethernet2/1/17:UP, gigabitethernet2/1/10:UP, gigabitethernet2/1/5:UP, gigabitethernet2/1/9:UP, gigabitethernet2/1/36:DOWN, gigabitethernet2/1/33:DOWN, gigabitethernet2/1/8:UP,... (19 Replies)
Discussion started by: wanttolearn1
19 Replies

7. Shell Programming and Scripting

awk to parse field and include the text of 1 pipe in field 4

I am trying to parse the input in awk to include the |gc= in $4 but am not able to. The below is close: awk so far: awk '{sub(/\|]+]++/, ""); print }' input.txt Input chr1 955543 955763 AGRN-6|pr=2|gc=75 0 + chr1 957571 957852 AGRN-7|pr=3|gc=61.2 0 + chr1 970621 ... (7 Replies)
Discussion started by: cmccabe
7 Replies

8. Shell Programming and Scripting

awk to match field between two files and use conditions on match

I am trying to look for $2 of file1 (skipping the header) in $2 of file2 (skipping the header) and if they match and the value in $10 is > 30 and $11 is > 49, then print the line from file1 to a output file. If no match is foung the line is not printed. Both the input and output are tab-delimited.... (3 Replies)
Discussion started by: cmccabe
3 Replies

9. UNIX for Beginners Questions & Answers

Pivoting data based on a header field

Hi Team, Could you please help me with the below scenario. I have a file which is in the below format. Zipcode,001,001f,002,002f,003,003f,004,004f,005,005f,006,006f,007,007f 0050, ,0, ,0, ,0, ,1,*,7, ,7, ,7 0060, ,0, ,0, ,7, ,0,*,7, ,0, ,0 Would need the output as below. First field... (1 Reply)
Discussion started by: saj
1 Replies

10. UNIX for Beginners Questions & Answers

Problem with getting awk to multiply a field by a value set based on condition of another field

Hi, So awk is driving me crazy on this one. I have searched everywhere and read man, docs and every related post Google can find and still no luck. The actual files I need to run this on are sensitive in nature, but it is the same thing as if I needed to calculate weighted grades for multiple... (15 Replies)
Discussion started by: cotilloe
15 Replies
HTML::FormFu::Filter(3pm)				User Contributed Perl Documentation				 HTML::FormFu::Filter(3pm)

NAME
HTML::FormFu::Filter - Filter Base Class SYNOPSIS
--- elements: - type: Text name: foo filters: - type: Encode candidates: - utf8 - Hebrew - type: Text name: bar filters: - LowerCase - Encode filters: - TrimEdges DESCRIPTION
"filters()" and "filter" can be called on any form, block element (includes fieldsets) or field element. If called on a field element, no "name" argument should be passed. If called on a form or block element, if no "name" argument is provided, a new filter is created for and added to every field on that form or block. See "FORM LOGIC AND VALIDATION" in HTML::FormFu for further details. METHODS
type Returns the "type" argument originally used to create the filter. localise_args Provide arguments that should be passed to localize to replace "[_1]", "[_2]", etc. in the localized string. parent Returns the HTML::FormFu::Element::_Field object that the filter is associated with. get_parent Arguments: \%options Traverses the parent hierarchy, returning the first parent that matches the supplied options. form Returns the HTML::FormFu object that the filter's field is attached to. name Shorthand for "$filter->parent->name" CORE FILTERS
HTML::FormFu::Filter::Callback HTML::FormFu::Filter::CompoundJoin HTML::FormFu::Filter::CompoundSprintf HTML::FormFu::Filter::CopyValue HTML::FormFu::Filter::Default HTML::FormFu::Filter::Encode HTML::FormFu::Filter::FormatNumber HTML::FormFu::Filter::HTMLEscape HTML::FormFu::Filter::HTMLScrubber HTML::FormFu::Filter::LowerCase HTML::FormFu::Filter::NonNumeric HTML::FormFu::Filter::Regex HTML::FormFu::Filter::Split HTML::FormFu::Filter::TrimEdges HTML::FormFu::Filter::UpperCase HTML::FormFu::Filter::Whitespace FILTER BASE CLASSES
The following are base classes for other filters, and generally needn't be used directly. HTML::FormFu::Filter::_Compound AUTHOR
Carl Franks, "cfranks@cpan.org" Based on the original source code of HTML::Widget::Filter, by Sebastian Riedel. LICENSE
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-01-23 HTML::FormFu::Filter(3pm)
All times are GMT -4. The time now is 01:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy