how to add the number of row and count number of rows
Hi experts a have a very large file and I need to add two columns: the first one numbering the incidence of records and the another with the total count
The input file:
desired output file:
thanks in advance
Last edited by radoulov; 07-15-2010 at 09:45 AM..
Reason: Code tags, please!
hi
i am pretty new to unix .i am ETL guy
I need a unix script to take row count of a file and write it to another file
the problem with wc-l is it include filename also
wc -l abc.dat
will give me like 1000 abc.dat
i just want 1000 to be written
can u just take 2 min to write a simple... (1 Reply)
Hi,
Suppose i have a inputfile in csv format.
How to use awk to count 'the number of nonempty columns in each row' minus one, and add the value as a new column in the end
For cosmetic reason, it's even better to include a descriptive label for the last column in the first row.
for... (2 Replies)
Hi All,
I have the following input which i want to process using AWK.
Rows,NC,amount
1,1202,0.192387
2,1201,0.111111
3,1201,0.123456
i want the following output
count of rows = 3 ,sum of amount = 0.426954
Many thanks (2 Replies)
Could anybody help with this?
I have input below .....
david,39
david,39
emelie,40
clarissa,22
bob,42
bob,42
tim,32
bob,39
david,38
emelie,47
what i want to do is count how many names there are with different ages, so output would be like this ....
david,2
emelie,2
clarissa,1... (3 Replies)
This is the source file, we called it errorlist.out
196 server_a server_unix_2 CD
196 server_b server_win_1 CD
196 server_c server_win_2 CD
196 server_bd server_unix_2 CD
196 server_d server_unix_2 CD
196 server_es server_win_1 CD
196 ... (14 Replies)
Hi All,
I need to extract duplicate rows from a file and write these bad records into another file. And need to have a count of these bad records.
i have a command
awk '
{s++}
END {
for(i in s) {
if(s>1) {
print i
}
}
}' ${TMP_DUPE_RECS}>>${TMP_BAD_DATA_DUPE_RECS}... (5 Replies)
Greetings!
I have been trying to find out a way to take a CSV file with a large number of rows, and a very large number of columns (in the thousands) and convert the rows to a single column of data, where the first row is a header representing the attribute name and the subsequent series of... (3 Replies)
Hi,
I need a solaris shell script to read multiple files and count number of unique name rows(strings) from those files. The input and output should be like this
Input:
file 1
abc
cde
abc ... (9 Replies)
we want the count of number of records to be printed on each row.
For Ex:
if there are 5 records on one unique id , the count "5'' should be printed on each record in other column. Please help for this. I am using unix & Cygwin.
Below are sample records:
KCZ0650473... (2 Replies)
I have a file with 48 rows. I am counting 6 rows and adding 6 to that number and repeating the operation, and then output the value in column 1. For the second column, I would like to get sort of a binary output (1s and 2s) every 3rd row. This is what I have:
awk '{print ++src +... (1 Reply)
Discussion started by: Xterra
1 Replies
LEARN ABOUT DEBIAN
mimedefang-notify
MIMEDEFANG-NOTIFY(7) Miscellaneous Information Manual MIMEDEFANG-NOTIFY(7)NAME
mimedefang-notify - Conventions used by mimedefang-multiplexor(8) to notify an external program of state changes.
DESCRIPTION
If you supply the -O option to mimedefang-multiplexor, then it allows external programs to connect to a socket and be notified of certain
state changes in the multiplexor. The external programs can react in whatever way they choose to these state changes. The external pro-
gram that listens for state changes is referred to as a listener.
NOTIFICATION OVERVIEW
From the point of view of a listener, notification works like this:
1) The listener connects to a TCP or UNIX-domain socket.
2) The listener informs mimedefang-multiplexor of the message types it is interested in.
3) The listener loops, reading messages from the socket and reacting to them.
MESSAGES
Each message from the multiplexor normally consists of a single upper-case letter, possibly followed by a space and some arguments, and
then followed by a newline.
Two special messages are "*OK" followed by a newline, which is issued when a listener first connects, and "*ERR" followed by some text and
a newline, which is issued when an error occurs.
The normal messages are:
B This message is issued whenever a slave is killed because of a busy timeout.
F n This message is issued whenever the number of free slaves changes. The parameter n is the number of free slaves.
R This message is issued whenever someone has forced a filter reread.
S n nmsg
This message is issued whenever slave n's status tag changes. The status tag is a string indicating what the slave is currently
doing; the -Z option to the multiplexor allows the Perl code to update the status tag so you have a good idea what each slave is
doing.
U This message is issued whenever a slave has died unexpectedly.
Y This message is issued whenever the number of free slaves changes from zero to non-zero.
Z This message is issued whenever the number of free slaves falls to zero.
EXPRESSING INTEREST
A listener does not receive any messages until it has expressed interest in various message types. To express interest, the listener
should send a question mark ("?") followed by the types of messages it is interested in, followed by a newline over the socket. For exam-
ple, a listener interested in the R and F messages would send this line:
?RF
A listener interested in every possible message type should send:
?*
Once a listener has expressed interest, it may receive messages at any time, and should monitor the socket for messages.
Note that a listener always receives the special messages "*OK" and "*ERR", even if it has not expressed interest in them.
EXAMPLE
The following Perl script implements a listener that, on Linux, rejects new SMTP connections if all slaves are busy, and accepts them again
once a slave is free. Existing SMTP connections are not shut down; the system merely refuses new connections if all the slaves are busy.
This script assumes that you have used the -O inet:4567 option to mimedefang-multiplexor.
#!/usr/bin/perl -w
#
# On Linux, prepare to use this script like this:
# /sbin/iptables -N smtp_connect
# /sbin/iptables -A INPUT --proto tcp --dport 25 --syn -j smtp_connect
# Then run the script as root.
use IO::Socket::INET;
sub no_free_slaves {
print STDERR "No free slaves!
";
system("/sbin/iptables -A smtp_connect -j REJECT");
}
sub some_free_slaves {
print STDERR "Some free slaves.
";
system("/sbin/iptables -F smtp_connect");
}
sub main {
my $sock;
$sock = IO::Socket::INET->new(PeerAddr => '127.0.0.1',
PeerPort => '4567',
Proto => 'tcp');
# We are only interested in Y and Z messages
print $sock "?YZ
";
$sock->flush();
while(<$sock>) {
if (/^Z/) {
no_free_slaves();
}
if (/^Y/) {
some_free_slaves();
}
}
# EOF from multiplexor?? Better undo firewalling
system("/sbin/iptables -F smtp_connect");
}
main();
SEE ALSO mimedefang.pl(8), mimedefang(8), mimedefang-multiplexor(8), mimedefang-filter(5)4th Berkeley Distribution 8 February 2005 MIMEDEFANG-NOTIFY(7)