As is often the case with a little bit of jiggery pokery there is a pseudo-back-door.
The storage device can be your friend although it will slow things down with the disk thrashing and huge numbers.
NOTE: This uses 'dash' which means it is fully POSIX compliant.
Results OSX 10.14.3, default terminal.
This User Gave Thanks to wisecracker For This Post:
Hi,
I use AIX (ksh) and Linux (bash) servers. I'm trying to do scripts to will run in both ksh and bash, and most of the time it works. But this time I don't get it in bash (I'm more familar in ksh).
The goal of my script if to read a "config file" (like "ini" file), and make various report.... (2 Replies)
Hi,
I have a file (details.txt) with 3 rows of variables ie...
name postcode age
john D fr25dd 25
mark W ab122aa 22
phil C cd343bb 33
What I want to do is read down the list with a loop and add each field into a one line piece of text...
So I have a file (test1) which reads;... (3 Replies)
I am writing a shell script using the korn shell. It seems that I am only
able to use local variables within a while loop that is reading a file.
(I can't access a variable outside a previously used while loop.) It's been
a while since I wrote shell scripts. Here is a sample
cat file.txt... (4 Replies)
Hi Friends ,
Sorry if this is a repeated question ,
The input file contains 5 lines , so the the values of the variables i and count should b
i=5;
count=15
but the variables are not updating , the value of variables showing i=0 and count =0 only.:mad:
can any1 help me please. (11 Replies)
Hello
I am having issues with a script I'm working on developing on a Solaris machine.
The script is intended to find out how many times a particular user (by given userid) has logged into the local system for more than one hour today.
Here is my while loop:
last $user | grep -v 'sshd'... (7 Replies)
Hi All,
I've been researching this problem and I am pretty sure that the issue is related to the while loop and the piping. There are plenty of other threads about this issue that recommend removing the pipe and using redirection. However, I haven't been able to get it working using the ssh and... (1 Reply)
Hi,
I have a loop running until a variable L that is read previously in the full script. I'd like to grep some information in an input file at a line that contains the value of the loop parameter $i.
I've tried to use grep, but the problem is nothing is written in the FILE files. It seems grep... (5 Replies)
Hello! Before you "bash" me with
- Not another post of this kind
Please read on and you will understand my problem...
I am using the below to extract a sum of the diskIO on a Solaris server.
#!/bin/sh
PATH=/usr/bin:/usr/sbin:/sbin; export PATH
TEMP1="/tmp/raw-sar-output.txt$$"... (3 Replies)
Dear mentors, I just need little explanation regarding for loop to give input to awk script
for file in `ls *.txt |sort -t"_" -k2n,2`; do
awk script $file
done
which sorts file in order, and will input one after another file in order to awk script
suppose if I have to input 2 or... (4 Replies)
Hi,
I'm a Delphi developer new to linux, new to this forums and new to BASH programming and got a new task in my work: maintaining an existing set of BASH scripts. First thing I want to do is making the code more reliable as in my opinion it's really bad written. So here's the quest:
I'm... (6 Replies)
Discussion started by: rse
6 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)