06-10-2009
Quote:
Originally Posted by
gsiva
Got an error message while checking with the command:
q -l | awk -F'[@>]' '/^From:/ {a[$(NF-1)]} END{for(i in a) print a[i], i}'
Error Msg:
readline() on closed filehandle MSG at /bin/q line 295 (#1)
(W closed) The filehandle you're reading from got itself closed sometime
before now. Check your control flow.
This's got nothing to do with the 'awk' suggestion - your 'q -l' throwing out an error.
10 More Discussions You Might Find Interesting
1. Programming
This gives :
after calling it twice:
how can i solve this so that on output i get : (8 Replies)
Discussion started by: C|[anti-trust]
8 Replies
2. Shell Programming and Scripting
I have the following problem. The file contains many lines already sorted according to their first arguments. Some of these first arguments are repetitive. For each first argument value, I need to keep the first and the last line that contain it. For example,
...
1 234
1 348
...
...
5 483... (2 Replies)
Discussion started by: jijibabawu
2 Replies
3. UNIX for Dummies Questions & Answers
Hi everyone,
I have a file in which a word is repeated more than one time and I want to know how many times it is repeated.
ex: if i repeated word 'guru' in 10 lines I can get the o/p as:
cat filename | grep -c 'guru'.
How ever if the word is repeated more than one time, then how can I... (4 Replies)
Discussion started by: gurukottur
4 Replies
4. Shell Programming and Scripting
I have a list like this:
todu
todo
tofe
tafo
I want to grep only the lines where the 2nd and the 4th character are the same.
In this case I would get only "todo".
Thanks. (3 Replies)
Discussion started by: rlopes
3 Replies
5. Shell Programming and Scripting
I have a text file where I need to find the string = ST*850*
This string is repetaed several times in the file, so I need to know how many times it appears in the file, this is the text files:
ISA*00* *00* *08*925485USNR *ZZ*IMSALADDERSP... (13 Replies)
Discussion started by: cucosss
13 Replies
6. Shell Programming and Scripting
Hi below is the input file, i need to find repeated words and sum up the values of it which is second field from the repeated work.Im trying but getting no where close to it.Kindly give me a hint on how to go about it
Input
fruits,apple,20,fruits,mango,20,veg,carrot,12,veg,raddish,30... (11 Replies)
Discussion started by: 100bees
11 Replies
7. Shell Programming and Scripting
Hi all
if i want to get the 3 lines of the most repeated lines here
tony,1,x
tony,1,x
tony,2,x
tony,2,x
tony,3,x
tony,4,x
tony,5,x
adam,1,y
to get output
tony,1,x
tony,2,x
tony3,x
adam,1,y (3 Replies)
Discussion started by: teefa
3 Replies
8. Shell Programming and Scripting
Hi all ,
i want to get the most repeated column in my file
File:
name,ID
adam,12345 ----1
adam,12345 ----2
adam,934
adam,12345 ----3
john,14
john,13
john,25 ----1
john,25 ----2
tom,1 -----1
tom,2 -----1
so my output to be (5 Replies)
Discussion started by: teefa
5 Replies
9. UNIX for Dummies Questions & Answers
I have a requirement where I have to read the lines between a repeated string
FileName: abc.txt
ls /data/abc.txt
1
2
#ZENCO
3
4
5
6
#ZENCO
11
213
454
7
#ZENCO (8 Replies)
Discussion started by: eskay
8 Replies
10. UNIX for Beginners Questions & Answers
+ 8.00747 /NodeList/0/DeviceList/0/$ns3::PointToPointNetDevice/TxQueue/Enqueue ns3::PppHeader (Point-to-Point Protocol: IP (0x0021)) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 63 id 0 protocol 17 offset (bytes) 0 flags length: 540 10.1.3.3 > 10.1.2.4) ns3::UdpHeader (length: 520 49153 >... (11 Replies)
Discussion started by: Nipa
11 Replies
LEARN ABOUT DEBIAN
io::bufferedselect
IO::BufferedSelect(3pm) User Contributed Perl Documentation IO::BufferedSelect(3pm)
NAME
IO::BufferedSelect - Line-buffered select interface
SYNOPSIS
use IO::BufferedSelect;
my $bs = new BufferedSelect($fh1, $fh2);
while(1)
{
my @ready = $bs->read_line();
foreach(@ready)
{
my ($fh, $line) = @$_;
my $fh_name = ($fh == $fh1 ? "fh1" : "fh2");
print "$fh_name: $line";
}
}
DESCRIPTION
The "select" system call (and the "IO::Select" interface) allows us to process multiple streams simultaneously, blocking until one or more
of them is ready for reading or writing. Unfortunately, this requires us to use "sysread" and "syswrite" rather than Perl's buffered I/O
functions. In the case of reading, there are two issues with combining "select" with "readline": (1) "select" might block but the data we
want is already in Perl's input buffer, ready to be slurped in by "readline"; and(2) "select" might indicate that data is available, but
"readline" will block because there isn't a full $/-terminated line available.
The purpose of this module is to implement a buffered version of the "select" interface that operates on lines, rather than characters.
Given a set of filehandles, it will block until a full line is available on one or more of them.
Note that this module is currently limited, in that(1) it only does "select" for readability, not writability or exceptions; and(2) it
does not support arbitrary line separators ($/): lines must be delimited by newlines.
CONSTRUCTOR
new ( HANDLES )
Create a "BufferedSelect" object for a set of filehandles. Note that because this class buffers input from these filehandles
internally, you should only use the "BufferedSelect" object for reading from them (you shouldn't read from them directly or pass them
to other BufferedSelect instances).
METHODS
read_line
read_line ($timeout)
read_line ($timeout, @handles)
Block until a line is available on one of the filehandles. If $timeout is "undef", it blocks indefinitely; otherwise, it returns after
at most $timeout seconds.
If @handles is specified, then only these filehandles will be considered; otherwise, it will use all filehandles passed to the
constructor.
Returns a list of pairs "[$fh, $line]", where $fh is a filehandle and $line is the line that was read (including the newline, ala
"readline"). If the filehandle reached EOF, then $line will be undef. Note that "reached EOF" is to be interpreted in the buffered
sense: if a filehandle is at EOF but there are newline-terminated lines in "BufferedSelect"'s buffer, "read_line" will continue to
return lines until the buffer is empty.
SEE ALSO
IO::Select
AUTHOR
Antal Novak, <afn@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2007 by Antal Novak
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or,
at your option, any later version of Perl 5 you may have available.
perl v5.10.1 2007-03-13 IO::BufferedSelect(3pm)