11-11-2009
Processing records as group - awk
I have a file has following records
policy glb id 1233 name Permit ping from "One" to "Second" "Address1" "Any" "ICMP-ANY" permit
policy id 999251
service "snmp-udp"
exit
policy glb id 1234 name Permit telnet from "One" to "Second" "Address2" "Any" "TCP-ANY" permit
policy id 1234
service "tcp"
exit
I want to generate a record for each glb id. exit is the end for each policy id.
the expected Output is:
#id#name,type,from,to,Address,service
1233,Permit ping,glb,One,Second,Address1,snmp-udp
1234,Permit telnet,glb,One,Second,Address2,snmp-tcp
Thanks in advance
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am an Awk newbie and cannot wrap my brain around my problem:
Given multi-line records of varying lengths separated by a blank line I need to skip the first two lines
of every record and extract every-other line in each record unless the first line of the record has the word "(CONT)" in the... (10 Replies)
Discussion started by: RacerX
10 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I have a file that contains some records that I would like to process
each line that I am interested in. My goal is to create a new file that contains only the rest_of_line for each line that matches.
It has the following File Format
command, platform, rest_of_line"
I am searching the... (2 Replies)
Discussion started by: CAGIRL
2 Replies
3. Shell Programming and Scripting
hi,
i have records like this
supplier,product, persons involved
10,150,ravi@yahoo.com
30,200,ravi@yahoo.com
20,111,payal@gmail.com
40,211,ravi@yahoo.com
i want to write a command which displays values like this
10,30,40,ravi@yahoo.com
for ravi@yahoo.com if there are n number of... (7 Replies)
Discussion started by: trichyselva
7 Replies
4. Shell Programming and Scripting
hi,
I have records like this
D127@dm.com,127,569,BRAD,25/08/2009 23:59
D127@dm.com,127,569,BRAD,25/08/2009 23:59
D159@dm.com,159,1170,DAVE,25/08/2009 23:59
D159@dm.com,159,1181,HALE,25/08/2009 23:59
D393@dm.com,393,1209,CAPIT,25/08/2009 23:59
D457@dm.com,457,571,NORTT,25/08/2009 23:59... (4 Replies)
Discussion started by: trichyselva
4 Replies
5. UNIX for Dummies Questions & Answers
input:
ref.1;rack.1;1 #group1
ref.1;rack.1;2 #group1
ref.1;rack.2;1 #group2
ref.2;rack.3;1 #group3
ref.2;rack.3;2 #group3
ref.2;rack.3;3 #group3
Among records from same group (i.e. with same 1st and 2nd field - separated by ";"), I would need to keep the last record... (5 Replies)
Discussion started by: beca123456
5 Replies
6. Programming
Hello,
I extracted a list of files in a directory with the command ls . However this is not my computer, so the ls functionality has been revamped so that it gives the filesizes in front like this :
This is the output of ls command : I stored the output in a file filelist
1.1M... (5 Replies)
Discussion started by: ajayram
5 Replies
7. Shell Programming and Scripting
Hi,
I want to read multiple records from oracle database table and then based on each record I need to do some file modifications in UNIX.
I'm not sure how do I process each record from DB in UNIX.Below is the code snippet.
sqlplus user/pwd@DEV
for i IN (select * from table)
loop
-- for... (2 Replies)
Discussion started by: prats_7678
2 Replies
8. UNIX for Beginners Questions & Answers
Hi,
My input looks like that:
A|123|qwer
A|456|tyui
A|456|wsxe
B|789|dfgh
Using awk, I am trying to get:
A|123;456|qwer;tyui;wsxe
B|789|dfgh
For records with same $1, group all the $2 in a field (without replicates), and all the $3 in a field (without replicates).
What I have tried:... (6 Replies)
Discussion started by: beca123456
6 Replies
9. Shell Programming and Scripting
Hi All,
I am using RHEL 6.9. I got a requirement to group the records in a file.The file content as shown below.
#### FAILED JOBS IN XXX #####
1> ABCD failed in the project XXX
2> HJK Job is in compiled state in the project XXX
3> ILKD failed in the project XXX
4> DFG failed in the... (5 Replies)
Discussion started by: ginrkf
5 Replies
LEARN ABOUT DEBIAN
rapolicy
RAPOLICY(1) General Commands Manual RAPOLICY(1)
NAME
rapolicy - compare a argus(8) data file/stream against a Cisco Access Control List.
COPYRIGHT
Copyright (c) 2000-2003 QoSient. All rights reserved.
SYNOPSIS
rapolicy -r argus-file [ra options]
DESCRIPTION
Rapolicy reads argus data from an argus-file list, and tests the argus data stream against a Cisco access control list configuration file,
printing out records that represent activity that would violate the policy. Rapolicy can be used to indicate access control violations, as
well as test new access control definitions prior to installing them in a router.
OPTIONS
Rapolicy, like all ra based clients, supports a large number of options. Options that have specific meaning to rapolicy are:
-f <Cisco ACL file> Print records that violate the policy.
-D 0 (default) Print records that violate the policy.
-D 1 Print records and the violated ruleset.
-D 2 Print all records and the ruleset that matched.
See ra(1) for a complete description of ra options.
EXAMPLE INVOCATION
rapolicy -r argus.file
CISCO ACL SYNTAX
There does not seem to be authoritative Cisco-ACL-Documentation, nor ACL syntax standardization. Because Cisco has been know to improve
its ACL rules syntax, rapolicy is known to work with Cisco ACL router defintions up to July, 2002.
A Cisco ACL configuration file consists of a collection of any number of ACL statements, each on a separte line. The syntax of an ACL
statement is:
ACL = "access-list" ID ACTION PROTOCOL SRC DST NOTIFICATION
ID = Number
ACTION = permit | deny
PROTO = protocol name | protocol number
SRC | DST = ADDRESS [PORTMATCH]
ADDRESS = any | host HOSTADDR | HOSTADDR HOSTMASK
HOSTADDR = ipV4 address
HOSTMASK = matching-mask
PORTMATCH = PORTOP PORTNUM | range PORTRANGE
PORTOP = eq | lt | gt | neq | established
PORTRANGE = PORTNUM PORTNUM
PORTNUM = TCP or UDP port value (unsigned decimal from 0 to 65535)
EXAMPLE CONFIGURATION
This example Cisco Access Control List configuration is provided as an example only. No effort has been made to verify that this example
Access Control List enforces a useful access control policy of any kind.
#allow www-traffic to webserver
access-list 102 permit tcp any 193.174.13.99 0.0.0.0 eq 80
#allow ftp control connection to server
access-list 102 permit tcp any 193.174.13.99 0.0.0.0 eq 21
#allow normal ftp
access-list 102 permit tcp any 193.174.13.99 0.0.0.0 eq 20
#allow ftp passive conncetions in portrange 10000 to 10500
access-list 102 permit tcp any host 193.174.13.99 range 10000 10500
#dummy example
access-list 102 permit tcp host 193.174.13.1 eq 12345 host 193.174.13.2 range 12345 23456
#deny the rest
access-list 102 deny tcp any any
#same thing in other words:
access-list 102 deny tcp 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255
AUTHORS
Carter Bullard (carter@qosient.com).
Olaf Gellert (gellert@pca.dfn.de).
SEE ALSO
ra(1), rarc(5), argus(8)
22 July 2002 RAPOLICY(1)