First, thanks for the help in previous posts... couldn't have gotten where I am now without it!
So here is what I have, I use AWK to match $1 and $2 as 1 string in file1 to $1 and $2 as 1 string in file2. Now I'm wondering if I can extend this AWK command to incorporate the following:
If $1... (4 Replies)
Hi all!
I have a data set in this tab separated format : Label, Value1, Value2
An instance is "data.txt" :
0 1 1
-1 2 3
0 2 2
I would like to parse this data set and generate two files, one that has only data with the label 0 and the other with label -1, so my outputs should be, for... (1 Reply)
Hello:
I am working parsing a large input file which will be broken down into multiples based on the second field in the file, in this case: STORE.
The idea is to create each file with the corresponding store number, for example: Report_$STORENUM_$DATETIMESTAMP , and obtaining the... (7 Replies)
i run command that return this result,example :
gigabitethernet2/2/4:NotPresent, gigabitethernet2/1/17:UP, gigabitethernet2/1/10:UP, gigabitethernet2/1/5:UP,
gigabitethernet2/1/9:UP, gigabitethernet2/1/36:DOWN, gigabitethernet2/1/33:DOWN, gigabitethernet2/1/8:UP,... (19 Replies)
I am trying to parse the input in awk to include the |gc= in $4 but am not able to. The below is close:
awk so far:
awk '{sub(/\|]+]++/, ""); print }' input.txt Input
chr1 955543 955763 AGRN-6|pr=2|gc=75 0 +
chr1 957571 957852 AGRN-7|pr=3|gc=61.2 0 +
chr1 970621 ... (7 Replies)
I am trying to look for $2 of file1 (skipping the header) in $2 of file2 (skipping the header) and if they match and the value in $10 is > 30 and $11 is > 49, then print the line from file1 to a output file. If no match is foung the line is not printed. Both the input and output are tab-delimited.... (3 Replies)
Hi Team,
Could you please help me with the below scenario.
I have a file which is in the below format.
Zipcode,001,001f,002,002f,003,003f,004,004f,005,005f,006,006f,007,007f
0050, ,0, ,0, ,0, ,1,*,7, ,7, ,7
0060, ,0, ,0, ,7, ,0,*,7, ,0, ,0
Would need the output as below.
First field... (1 Reply)
Hi,
So awk is driving me crazy on this one. I have searched everywhere and read man, docs and every related post Google can find and still no luck. The actual files I need to run this on are sensitive in nature, but it is the same thing as if I needed to calculate weighted grades for multiple... (15 Replies)
Discussion started by: cotilloe
15 Replies
LEARN ABOUT DEBIAN
poe::filter::line
POE::Filter::Line(3pm) User Contributed Perl Documentation POE::Filter::Line(3pm)NAME
POE::Filter::Line - serialize and parse terminated records (lines)
SYNOPSIS
#!perl
use POE qw(Wheel::FollowTail Filter::Line);
POE::Session->create(
inline_states => {
_start => sub {
$_[HEAP]{tailor} = POE::Wheel::FollowTail->new(
Filename => "/var/log/system.log",
InputEvent => "got_log_line",
Filter => POE::Filter::Line->new(),
);
},
got_log_line => sub {
print "Log: $_[ARG0]
";
}
}
);
POE::Kernel->run();
exit;
DESCRIPTION
POE::Filter::Line parses stream data into terminated records. The default parser interprets newlines as the record terminator, and the
default serializer appends network newlines (CR/LF, or "x0Dx0A") to outbound records.
Record terminators are removed from the data POE::Filter::Line returns.
POE::Filter::Line supports a number of other ways to parse lines. Constructor parameters may specify literal newlines, regular
expressions, or that the filter should detect newlines on its own.
PUBLIC FILTER METHODS
POE::Filter::Line's new() method has some interesting parameters.
new
new() accepts a list of named parameters.
In all cases, the data interpreted as the record terminator is stripped from the data POE::Filter::Line returns.
"InputLiteral" may be used to parse records that are terminated by some literal string. For example, POE::Filter::Line may be used to
parse and emit C-style lines, which are terminated with an ASCII NUL:
my $c_line_filter = POE::Filter::Line->new(
InputLiteral => chr(0),
OutputLiteral => chr(0),
);
"OutputLiteral" allows a filter to put() records with a different record terminator than it parses. This can be useful in applications
that must translate record terminators.
"Literal" is a shorthand for the common case where the input and output literals are identical. The previous example may be written as:
my $c_line_filter = POE::Filter::Line->new(
Literal => chr(0),
);
An application can also allow POE::Filter::Line to figure out which newline to use. This is done by specifying "InputLiteral" to be undef:
my $whichever_line_filter = POE::Filter::Line->new(
InputLiteral => undef,
OutputLiteral => "
",
);
"InputRegexp" may be used in place of "InputLiteral" to recognize line terminators based on a regular expression. In this example, input
is terminated by two or more consecutive newlines. On output, the paragraph separator is "---" on a line by itself.
my $paragraph_filter = POE::Filter::Line->new(
InputRegexp => "([x0Dx0A]{2,})",
OutputLiteral => "
---
",
);
PUBLIC FILTER METHODS
POE::Filter::Line has no additional public methods.
SEE ALSO
Please see POE::Filter for documentation regarding the base interface.
The SEE ALSO section in POE contains a table of contents covering the entire POE distribution.
BUGS
The default input newline parser is a regexp that has an unfortunate race condition. First the regular expression:
/(x0Dx0A?|x0Ax0D?)/
While it quickly recognizes most forms of newline, it can sometimes detect an extra blank line. This happens when a two-byte newline
character is broken between two reads. Consider this situation:
some stream dataCR
LFother stream data
The regular expression will see the first CR without its corresponding LF. The filter will properly return "some stream data" as a line.
When the next packet arrives, the leading "LF" will be treated as the terminator for a 0-byte line. The filter will faithfully return this
empty line.
It is advised to specify literal newlines or use the autodetect feature in applications where blank lines are significant.
AUTHORS & COPYRIGHTS
Please see POE for more information about authors and contributors.
perl v5.14.2 2012-05-15 POE::Filter::Line(3pm)