Required help to print diff columns for 2 patterns using awk
Hi All,
I need help for below scenario :
I have a principals.xml_24092012backup file :
Below output is getting when I run ->
But I want to print column 2 ($2) for "username" pattern and column 2,3,4 for "rolename" pattern.
So Expected Output would be :
Could you please help me out to get above output.
Thanks in advance!
Regards,
Kiran
Last edited by Franklin52; 09-25-2012 at 07:42 AM..
Reason: Please use code tags for data and code samples
hi friends!
i have a script where a execute a veritas command, available_media wich retrieves me a list of tapes .lst
then i execute
cat /tmp/listtapes.lst | grep -v VL |sed '/^$/d'|awk -F, '{print $1, $3, $4, $9}
' > /tmp/media1.lst
but it prints all the columns instead of the four... (3 Replies)
I am looking help in awk, quick overview. we will get feed from external system . The input file looks like below.
Detail Id Info Id Order Id STATUS Status Date FileDetail
99127942 819718 CMOG223481502 PR 04-17-2011 06:01:34PM... (7 Replies)
I would like to print result of multiple search pattern invoked from an one liner. The code looks like this but won't work
gawk -F '{{if ($0 ~ /pattern1/) pat1=$1 && if ($0 ~ /pattern2/) pat2=$2} ; print pat1, pat2}'
Can anybody help getting the right code? (10 Replies)
Thanks for the help yesterday. I have a little modification today,
I am trying the following:
i have a log file of a webbap which logs in the following pattern:
2011-08-14 21:10:04,535 blablabla ERROR Exception1 blablabla
bla
bla
bla
bla
2011-08-14... (2 Replies)
Guys,
I am trying the following:
i have a log file of a webbap which logs in the following pattern:
2011-08-14 21:10:04,535 blablabla ERROR blablabla
bla
bla
bla
bla
2011-08-14 21:10:04,535 blablabla ERROR blablabla
bla
bla
bla
... (6 Replies)
Coins.txt:
gold 1 1986 USA American Eagle
gold 1 1908 Austria-Hungary Franz Josef 100 Korona
silver 10 1981 USA ingot
gold 1 1984 Switzerland ingot
gold 1 1979 RSA Krugerrand
gold 0.5 1981 RSA Krugerrand
gold 0.1 1986 PRC Panda
silver 1 1986 USA Liberty dollar
gold 0.25 1986 USA Liberty... (2 Replies)
Hi,
I am trying to extract some patterns from a line. The input file is space delimited and i could not use column to get value after "IN" or "OUT" patterns as there could be multiple white spaces before the next digits that i need to print in the output file . I need to print 3 patterns in a... (3 Replies)
What i'm trying to do here is show X amount of lines before and after the string "serialNumber" is found.
BEFORE=3
AFTER=2
gawk '{a=$0} {count=0} /serialNumber/ && /./ {for(i=NR-'"${BEFORE}"';i<=NR;i++){count++ ;print a}for(i=1;i<'"${AFTER}"';i++){getline; print ; count ++; print... (5 Replies)
Hi,
I'm trying to copy and paste the sixth column from a bunch of files into a single file having each column pasted in separate columns (and not one after each other in just one column.)
I tried this code but works only partially because it copied and pasted 50 rows of each column... (6 Replies)
Hi All,
i am trying to print required multiple columns dynamically from a fie.
But i am able to print only one column at a time.
i am new to shell script, please help me on this issue.
i am using below script
awk -v COLT=$1 '
NR==1 {
for (i=1; i<=NF; i++) {
... (2 Replies)
Discussion started by: balu1234
2 Replies
LEARN ABOUT DEBIAN
gradm2
GRADM(8) System Manager's Manual GRADM(8)NAME
gradm - Administration program for the grsecurity RBAC system
SYNOPSIS
gradm [ -E ] [ -R ] [ -C ] [ -F ] [ -L <logfile> ] [ -O <filename|stream> ] [ -M <filename|uid> ] [ -D ] [ -P [rolename] ] [ -a <rolename>
] [ -n <rolename> ] [ -p <rolename> ] [ -u ] [ -V ] [ -h ] [ -v ]
DESCRIPTION
gradm is the userspace RBAC parsing and authentication program for grsecurity
grsecurity aims to be a complete security system for Linux 2.4. gradm performs several tasks for the RBAC system including authenticated
via a password to the kernel and parsing rules to be passed to the kernel.
OPTIONS
All options to gradm are mutually exclusive, except for -L and -O.
-E Enable the RBAC system
-R Reload the RBAC system (only valid while in admin mode)
-C Perform a check of the RBAC policy, running the same analysis against it that is performed when enabling.
-F Toggle full learning mode. If used only with -L, it enables the RBAC system in full learning mode. If used with -L and -O, it
parses the full learning logs and generates a complete ruleset.
-M <filename|uid>
Remove an execution ban on a given uid or filename that has been put in place by the RES_CRASH resource restriction of the RBAC sys-
tem.
-L <logfile>
Parses the learning logs. Accepts an argument which specifies the logfile to scan for the learning logs. If "-" is specified as
the logfile, stdin will be used as the learning log. This option can be used with -E, -O, or -F.
-O <filename|stream>
Specifies output mode. Requires a single argument that can be "stdout", "stderr", or a regular file. Only used with -L or -F.
-D Disable the RBAC system
-P [rolename]
Without an argument, it sets the password for administering the RBAC system. With a role name as an argument, it sets the password
for that given special role.
-a <rolename>
Authenticate to a special role that requires a password.
-n <rolename>
Authenticate to a special role that does not require a password.
-p <rolename>
Authenticate through PAM to a special role.
-u Removes yourself from your current special role, reverting back to the normal role selection. To be used, for instance, for logging
out of an admin role without exiting your shell.
-V Displays verbose policy statistics when enabling the RBAC system or checking the RBAC policy. Can only be used with -C, -E, or -F
-L <filename>
-h Display help information
-v Print version information and exit
REPORTING BUGS
Please include as much information as possible(using any available debugging options) and send bug reports for gradm or the grsecurity RBAC
system to spender@grsecurity.net.
AUTHOR
grsecurity and gradm were created and are maintained by Brad Spengler <spender@grsecurity.net>
GRADM(8)