12-11-2009
Awk Script: Nested search using different patter
Hi Friends.
Please have a look at dummy file. I need to extract from this file:
1. Counts of event=
2. the 2nd coulmn is unique call id of this transaction. Based on that, i have to search for txstatus= .
Note: Values of event, calltype and txstatus can be anything.
I want to print the output something like:
No of event x:
No of event y:
txstatus x:
txstatus y:
In sample record event is callstart. it could be anything. Can i take it as variable and print the samething which is coming in file? similar for txstatus also. I need this to make it more dynamic and avoid hard codings of status etc....
====================
1260413928.455 1bc0c74a-d811-4b63-b602-b8bb044ebef3 event=callstart calltype=Deposit circuitid=0
1260413939.121 1bc0c74a-d811-4b63-b602-b8bb044ebef3 event=txend txid=2 txstatus=success
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello All, This work could be very easy for you guys. I would really appreciate help.
input file:
output file: (Desired)
What I am capable of doing:
Command: cat inputfile | awk -F\| '{print "num="$1" value="$2" digits="$3" name1="$4" file="$5" code="$6}' > outputfile
Result what I am... (5 Replies)
Discussion started by: onlyroshni
5 Replies
2. UNIX for Advanced & Expert Users
Hey all,
Can I put sed command inside the awk action ?? If not then can i do grep in the awk action ??
For ex:
awk '$1=="174" { ppid=($2) ; sed -n '/$ppid/p' tempfind.txt ; }' tempfind.txt
Assume: 174 is string.
Assume: tempfind.txt is used for awk and sed both.
tempfind.txt... (11 Replies)
Discussion started by: varungupta
11 Replies
3. Shell Programming and Scripting
I want to write a shell script which traverses a cpp file.
Suppose there is function fncn_name6 .. which is called by fncn_name5
which in turn called by fncn_name4 and so on .. in a single cpp class.
ie
fncn_name1
{
fncn_name2
{
fncn_name3
}
{
fncn_name4
... (0 Replies)
Discussion started by: ultimatix
0 Replies
4. Shell Programming and Scripting
please let me know if the below code could be written efficiently inside single awk
case "$INP" in
ksh)
cat catalog | awk 'BEGIN {FS=",";} { print $2 } END {}'
;;
pset)
cat catalog | awk 'BEGIN {FS=",";} { print $3 } END {}'
;;
dml)
cat catalog | awk 'BEGIN {FS=",";} {... (2 Replies)
Discussion started by: cvsanthosh
2 Replies
5. Shell Programming and Scripting
I am trying to search the pattern "ARS (11)" and after the LAST pattern, i am trying to open new line and enter text using sed.
My Existing Text file is Users.txtpaul, Paul Smith, Stevn Smiley, REQ000001, ARS (11)
sam, Sam Martin, Stevn Smiley, REQ000001, ARS (11)
mike, Mike Conway, Stevn... (8 Replies)
Discussion started by: evrurs
8 Replies
6. Shell Programming and Scripting
Hello again everyone,
yes, I'm back again for more help! So I'm attempting to read two separate files and generate some XML code from that. My current code is:
BEGIN {
print "<?xml version=\"1.0\" encoding=\"utf-8\">"
print "<Export>"
}
{
x=1;
print "<section name=\"Query" NR "\">"... (5 Replies)
Discussion started by: Parrakarry
5 Replies
7. Shell Programming and Scripting
Hi Team,
I am new to unix, please help me in this.
I have a file named properties.
The content of the file is :
##Mobile props
east.url=https://qa.east.corp.com/prop/end
west.url=https://qa.west.corp.com/prop/end
south.url=https://qa.south.corp.com/prop/end... (2 Replies)
Discussion started by: tolearn
2 Replies
8. Shell Programming and Scripting
I need help in awk script to do contains search and my requirement is below
I need to check if the value in each column is present in any other column and print it. And in some columns these value could be existing with comma as delimiter.
Sample data... (6 Replies)
Discussion started by: aramacha
6 Replies
9. Shell Programming and Scripting
I am trying to parse a text file and send its output to another file but I am having trouble conceptualizing how I am supposed to do this in awk.
The text file has a organization like so:
Name
Date
Status
Location (city, state, zip fields)
Where each of these is on a separate line in... (1 Reply)
Discussion started by: kellyanneghj
1 Replies
10. Shell Programming and Scripting
Hello.
I would like to convert the following piece of code from bash to awk.
Here are bash variables in a bash script.
CUR_ROW_ID and ROW_ID_TO_SEARCH contains a string which represent a row id.
The string contain a valid row id.
CUR_ROW_ID sometimes may be null.
CUR_VALUE... (3 Replies)
Discussion started by: jcdole
3 Replies
LEARN ABOUT DEBIAN
ecaccess-event-create
ECACCESS-EVENT-CREATE(1p) User Contributed Perl Documentation ECACCESS-EVENT-CREATE(1p)
NAME
ecaccess-event-create - Create an ECaccess Event
SYNOPSIS
ecaccess-event-create -version|-help|-manual
ecaccess-event-create [-debug] [-overwrite] [-public] [-comment string] event-name
DESCRIPTION
Allow creating an ECaccess Event. As a result the event-id is displayed.
If an event already exists with the same event-name then by default the request is rejected (please check the -overwrite option).
By default an event is private and restricted to its owner. Access can however be shared with other users thanks to the ecaccess-event-
grant command or with the -public option which make it visible to all.
ARGUMENTS
event-name
The name of the Event to create.
OPTIONS
-overwrite
Allow deleting an existing event with the same name and create a new one (the identifier will be however different to the original
one).
-public Allow creating a public event which can be used by everybody. In order to have a better tunning of the permissions please keep the
event private and use the ecaccess-event-grant command instead.
-comment string
Specify the string to display as a comment for the event.
-version
Display version number and exits.
-help Print a brief help message and exits.
-manual Prints the manual page and exits.
-debug Display the SOAP messages exchanged.
EXAMPLES
ecaccess-event-create -public -comment "My Comment" "My Event Name"
Create the new event with the name "My Event Name" and the comment "My Comment". This new event is public and other users can subscribe to
it.
SEE ALSO
ecaccess-event-grant, ecaccess-event-clear, ecaccess-event-send, ecaccess-event-list, ecaccess-event-delete and ecaccess.
perl v5.14.2 2012-04-16 ECACCESS-EVENT-CREATE(1p)