Sponsored Content
Full Discussion: AWK - Parse a big file
Top Forums Shell Programming and Scripting AWK - Parse a big file Post 302508715 by Chubler_XL on Monday 28th of March 2011 11:10:21 PM
Old 03-29-2011
Code:
awk '
 BEGIN { OFS=",";
    print "Symmetrix ID,DEV,Storage Group Name,Port Group Name,Initiator Group Name,Masking View Name,Port"
    split("SymmetrixID:,StorageGroupName,PortGroupName,InitiatorGroupName,MaskingViewName", T, ","); 
    for(i in T) GRP[T[i]]=i; }
 ($1$2$3 in GRP) { gsub(":", "", $NF); ID[GRP[$1$2$3]]=$NF }
 /^    / {getdev=0}
 getdev { print ID[1],$1,ID[2],ID[3],ID[4],ID[5],$2 }
 /^------/ { getdev=1 }' infile

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to view a big file(143M big)

1 . Thanks everyone who read the post first. 2 . I have a log file which size is 143M , I can not use vi open it .I can not use xedit open it too. How to view it ? If I want to view 200-300 ,how can I implement it 3 . Thanks (3 Replies)
Discussion started by: chenhao_no1
3 Replies

2. Shell Programming and Scripting

filter parts of a big file using awk or sed script

I need an assistance in file generation using awk, sed or anything... I have a big file that i need to filter desired parts only. The objective is to select (and print) the report # having the string "apple" on 2 consecutive lines in every report. Please note that the "apple" line has a HEX... (1 Reply)
Discussion started by: apalex
1 Replies

3. Shell Programming and Scripting

Big data file - sed/grep/awk?

Morning guys. Another day another question. :rolleyes: I am knocking up a script to pull some data from a file. The problem is the file is very big (up to 1 gig in size), so this solution: for results in `grep "^\ ... works, but takes ages (we're talking minutes) to run. The data is held... (8 Replies)
Discussion started by: dlam
8 Replies

4. Shell Programming and Scripting

Parse file using awk and work in awk output

hi guys, i want to parse a file using public function, the file contain raw data in the below format i want to get the output like this to load it to Oracle DB MARWA1,BSS:26,1,3,0,0,0,0,0.00,22,22,22.00 MARWA2,BSS:26,1,3,0,0,0,0,0.00,22,22,22.00 this the file raw format: Number of... (6 Replies)
Discussion started by: dagigg
6 Replies

5. Shell Programming and Scripting

big xml file with nested loop parse

I have an xml file with the structure: <tag1> <value1>xyx</value1> <value2>123</value2> </tag1> <tag1> <value1>568</value1> <value2>zzzzz</value2> </tag1> where I want to parse each data pair in the this single file, so something like: find first tag1 data pair... (1 Reply)
Discussion started by: unclecameron
1 Replies

6. Shell Programming and Scripting

awk column comparison big file

Hi all, I would like to compare a column in one file to a column in another file and when there is a match it prints the first column and the corresponding second column. Example File1 ABA ABC ABE ABF File 2 ABA 123 ABB 124 ABD 125 ABC 126 So what I would like printed to a... (6 Replies)
Discussion started by: pcg
6 Replies

7. Shell Programming and Scripting

Parse a file with awk?

Hi guys (and gals). I need some help. I'm running an IVR purely on Asterisk where I capture the DTMFs. After pulsing each DTMF I have Asterisk write to a file with whatever was dialed (mostly used for record-keeping) and at the end of the survey I write all variables in a single line to a... (2 Replies)
Discussion started by: tulf210
2 Replies

8. Shell Programming and Scripting

Parse a file using awk

Hi Experts, I am trying to parse the following file; FILEA a|b|c|c|c|c a|b|d|d|d|d e|f|a|a|a|a e|f|b|b|b|boutput expected: a<TAB>b <TAB><TAB>c<TAB>c<TAB>c<TAB>c<TAB> <TAB><TAB>d<TAB>d<TAB>d<TAB>d<TAB> e<TAB>f <TAB><TAB>a<TAB>a<TAB>a<TAB>a<TAB> <TAB><TAB>b<TAB>b<TAB>b<TAB>b<TAB>*... (7 Replies)
Discussion started by: rajangupta2387
7 Replies

9. Shell Programming and Scripting

Using awk to Parse File

Hi all, I have a file that contains a good hundred of these job definitions below: Job Name Last Start Last End ST Run Pri/Xit ________________________________________________________________ ____________________... (7 Replies)
Discussion started by: atticuss
7 Replies

10. Shell Programming and Scripting

Split a big file into multiple files using awk

this thread is a continuation from previous thread https://www.unix.com/shell-programming-and-scripting/223901-split-big-file-into-multiple-files-based-first-four-characters.html ..I am using awk to split file and I have a syntax error while executing the below code I am using AIX 7.2... (4 Replies)
Discussion started by: etldev
4 Replies
Info::Layer1(3pm)					User Contributed Perl Documentation					 Info::Layer1(3pm)

NAME
SNMP::Info::Layer1 - SNMP Interface to network devices serving Layer1 only. AUTHOR
Max Baker SYNOPSIS
# Let SNMP::Info determine the correct subclass for you. my $l1 = new SNMP::Info( AutoSpecify => 1, Debug => 1, DestHost => 'myswitch', Community => 'public', Version => 1 ) or die "Can't connect to DestHost. "; my $class = $l1->class(); print "SNMP::Info determined this device to fall under subclass : $class "; # Let's get some basic Port information my $interfaces = $l1->interfaces(); my $i_up = $l1->i_up(); my $i_speed = $l1->i_speed(); foreach my $iid (keys %$interfaces) { my $port = $interfaces->{$iid}; my $up = $i_up->{$iid}; my $speed = $i_speed->{$iid} print "Port $port is $up. Port runs at $speed. "; } DESCRIPTION
This class is usually used as a superclass for more specific device classes listed under SNMP::Info::Layer1::* Please read all docs under SNMP::Info first. Provides abstraction to the configuration information obtainable from a Layer1 device through SNMP. Information is stored in a number of MIBs. For speed or debugging purposes you can call the subclass directly, but not after determining a more specific class using the method above. my $l1 = new SNMP::Info::Layer1(...); Inherited Classes SNMP::Info Required MIBs SNMP-REPEATER-MIB MIBs required for "Required MIBs" in SNMP::Info See "Required MIBs" in SNMP::Info for its MIB requirements. SNMP-REPEATER-MIB needs to be extracted from ftp://ftp.cisco.com/pub/mibs/v1/v1.tar.gz GLOBALS
These are methods that return scalar value from SNMP $l1->ports_managed() Gets the number of ports under the interface mib ("ifNumber") Overrides $l1->model() Cross references $l1->id() with product IDs. For HP devices, removes 'hpswitch' from the name For Cisco devices, removes 'sysid' from the name $l1->vendor() Tries to discover the vendor from $l1->model() and $l1->vendor() $l1->ports() Adds the values from rptr_ports() and ports_managed() $l1->slots() Number of 'groups' in the Repeater MIB ("rptrGroupCapacity") Global Methods imported from SNMP::Info See documentation in "GLOBALS" in SNMP::Info for details. TABLE METHODS
These are methods that return tables of information in the form of a reference to a hash. Overrides $l1->interfaces() Returns reference to the map between IID and physical Port. $l1->i_up() Returns reference to map of IIDs to link status. $l1->i_up_admin() Returns reference to map of IIDs to administrative link status. Repeater MIB $l1->rptr_ports() Number of ports in each group. ("rptrGroupPortCapacity") $l1->rptr_port() Port number in Group ("rptrPortIndex") $l1->rptr_slot() Group (slot) Number for given port. ("rptrPortGroupIndex") $l1->rptr_up_admin() ("rptrPortAdminStatus") $l1->rptr_up() ("rptrPortOperStatus") $l1->rptr_last_src() ("rptrAddrTrackNewLastSrcAddress") Table Methods imported from SNMP::Info See documentation in "TABLE METHODS" in SNMP::Info for details. perl v5.12.4 2011-09-28 Info::Layer1(3pm)
All times are GMT -4. The time now is 08:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy