awk '
# Define function to print results for last aggregated data.
function printlast() {
# If "last" is not empty (which will be true except for the first time
# this function is called)...
if(last)
# print the results.
print last, count, appr
# Clear the accumulated count.
count = 0
}
# Before reading any input files, set the input and output field separators to a
# comma.
BEGIN { FS = OFS = ","
}
# When we are looking at the 1st line in an input file...
FNR == 1 {
# copy the header line to the output...
print
# and skip to the next input line without execcuting the remaining lines
# of this script for this line.
next
}
# If "last" does not match the first four fields of the current input line...
last != $1 OFS $2 OFS $3 OFS $4 {
# print the accumulated data for the previous line...
printlast()
# set "last" to the first four fields of the current input line...
last = $1 OFS $2 OFS $3 OFS $4
# and, set "appr" to the last field on this line.
appr = $6
}
# Add the count from the current line to the total for lines matching "last".
{ count += $5
}
# After we have processed all lines from the input file, print the accumulated
# data for the last set of aggregated data.
END { printlast()
}' file
This User Gave Thanks to Don Cragun For This Post:
Hi,
I have a file containing the following data:
junk123junk723itemcode001qty01price10total10junkjunk
junk123junk723itemcode002qty02price10total20junkjunk
..
..
..
could be 5000+ lines
I have an algo and need a code to implement this:
1. Linecount = wc -l (should give 5000)
2. For i... (1 Reply)
Hello how are you, i have a question i have a file ale.log and i want to agregate a title and later a space when the text is over and put another title (when the text is over) how can i do this? thank you
Example
Last ------>(Title) i want to agregate
pupu pupu pupu pupu... (1 Reply)
Hy all,
I have a problem...can some one help me...
I have a file of records sort:
30|239|ORD|447702936929 |blackberry.net |20080728|141304|00000900|2|0000000000000536|28181|0000000006|0000000001|10|1
30|239|ORD|447702936929 |blackberry.net ... (4 Replies)
Hi
I have a question related to load balancing.I have two separate internet connections with 2Mbps speed and i would like to aggregate this two connections intro one connection with 4Mbps.Is it possible to do that, to put a Linux or Unix machine as a gateway?I read some stuff to split the... (3 Replies)
Hi experts,
I need an help on the task below.
INPUT: values separated by the tab,first row is the header
20110609 AS A 300.5000
20110609 AS R 200.5000
20110609 BR A 111.5000
20110609 BR R 222.5000
20110610 AS A 100.5500
20110610 AS ... (2 Replies)
Hi all,
I have a problem where i'm trying to identify on which remote hosts the apps are running, ssh into it and restart them.
In case more than 1 apps is running on same remote host, i want to be able to group it and ssh only once.
E.g:
app1 = 1.1.1.1
app2 = 1.1.1.2
app3 =... (4 Replies)
hi all,
i start with solaris 11 and i am disapointed by the change on ip managing.
i want to set a ipmp over tow aggregate but i dont find any doc and i am lost with the new commande
switch1
net0 aggregate1 |
net1 aggregate1 |-----|
|... (1 Reply)
Discussion started by: sylvain
1 Replies
LEARN ABOUT CENTOS
rollback_prepared
ROLLBACK PREPARED(7) PostgreSQL 9.2.7 Documentation ROLLBACK PREPARED(7)NAME
ROLLBACK_PREPARED - cancel a transaction that was earlier prepared for two-phase commit
SYNOPSIS
ROLLBACK PREPARED transaction_id
DESCRIPTION
ROLLBACK PREPARED rolls back a transaction that is in prepared state.
PARAMETERS
transaction_id
The transaction identifier of the transaction that is to be rolled back.
NOTES
To roll back a prepared transaction, you must be either the same user that executed the transaction originally, or a superuser. But you do
not have to be in the same session that executed the transaction.
This command cannot be executed inside a transaction block. The prepared transaction is rolled back immediately.
All currently available prepared transactions are listed in the pg_prepared_xacts system view.
EXAMPLES
Roll back the transaction identified by the transaction identifier foobar:
ROLLBACK PREPARED 'foobar';
COMPATIBILITY
ROLLBACK PREPARED is a PostgreSQL extension. It is intended for use by external transaction management systems, some of which are covered
by standards (such as X/Open XA), but the SQL side of those systems is not standardized.
SEE ALSO
PREPARE TRANSACTION (PREPARE_TRANSACTION(7)), COMMIT PREPARED (COMMIT_PREPARED(7))
PostgreSQL 9.2.7 2014-02-17 ROLLBACK PREPARED(7)