Hi I am brand new to programming, I dont know how to go about this task, or what language is best for this...If there is an easy solution in different languages, I would love to see them. I want to learn about the steps to take on this, so Please put in comments where code is used.
I believe in... (9 Replies)
hi,
I have file with some data delimited by #.
For e.g. :
RHMS0001#1#ABCD
RHMS0002#1#ABCD
RHMS0003#1#ABCD
RHMS0004#1#ABCD
RHMS0005#1#ABCD
RHMS0006#1#ABCD
RHMS0007#1#ABCD
RHMS0001#2#ABCD
RHMS0002#2#ABCD
RHMS0001#3#ABCD
RHMS0004#3#ABCD
RHMS0006#3#ABCD (7 Replies)
Hello all,
I am looking for a solution to the following problem. Perl or python solutions also welcome.
Given this input:
And this input:
I want to get this output.
The rule being that if the number in the first file is < 0.9, then the corresponding two columns on... (2 Replies)
Hi, Unix gurus,
I have a requirement as following:
checking existing file, if the file only contain one line. then append "No data" else keep existing file as is.
can i achieve this by in command line without write a script.
:wall:
Thanks in advance. (4 Replies)
Hello Guys,
I am new to Unix and i got one requirement where I need to split my file into maximum 5 files on below conditions, if they are splitted into less than 5 then also we are fine.
Columns D value should appear in a single file only and shouldn't continue in other files.
... (1 Reply)
I need to read the contents of a file. Then I need to grep for a keyword and replace part of the grepped line based on the condition of previous and present line.
Example input file:
V {
port1 = P;
port2 = 0;
shift_port = P0; /* if next shift_port is P0 I need... (7 Replies)
I have a directory with files that was saved all along the day at different times. Every day I have to run a program that will select 50 files for each hour which has the maximum score.
Sample file name: a_b_c_d_e_f
where a,b,c,d,e,f are double values
Score calculation:
(a + b + c + d + e... (4 Replies)
Hello scriping expert friends,
I have 2 requirements on replacing fields of text files:
I have lot of data with contents like below:
Requirement-1:
The digit after 0 should always be changed to 1 (3 Replies)
Hello All,
I was wondering if there is a way to execute a command in my ".bashrc" file based on how I logged into the PC?
I was thinking maybe there is a way to check how the user (*myself) logged in, maybe somehow with the who command along with something else, but I'm not sure... I know I... (7 Replies)
Discussion started by: mrm5102
7 Replies
LEARN ABOUT DEBIAN
plack::middleware::conditional
Plack::Middleware::Conditional(3pm) User Contributed Perl Documentation Plack::Middleware::Conditional(3pm)NAME
Plack::Middleware::Conditional - Conditional wrapper for Plack middleware
SYNOPSIS
use Plack::Builder;
builder {
enable_if { $_[0]->{REMOTE_ADDR} eq '127.0.0.1' } 'StackTrace', force => 1;
$app;
};
# or using the OO interface:
$app = Plack::Middleware::Conditional->wrap(
$app,
condition => sub { $_[0]->{REMOTE_ADDR} eq '127.0.0.1' },
builder => sub { Plack::Middleware::StackTrace->wrap($_[0], force => 1) },
);
DESCRIPTION
Plack::Middleware::Conditional is a piece of meta-middleware, to run a specific middleware component under runtime conditions. The goal of
this middleware is to avoid baking runtime configuration options in individual middleware components, and rather share them as another
middleware component.
EXAMPLES
Note that some of the middleware component names are just made up for the explanation and might not exist.
# Minify JavaScript if the browser is Firefox
enable_if { $_[0]->{HTTP_USER_AGENT} =~ /Firefox/ } 'JavaScriptMinifier';
# Enable Stacktrace when being accessed from the local network
enable_if { $_[0]->{REMOTE_ADDR} =~ /^10.0.1.*/ } 'StackTrace';
# Work with other conditional setter middleware:
# Transcode Jpeg on the fly for mobile clients
builder {
enable 'MobileDetector';
enable_if { $_[0]->{'plack.mobile_detected'} }
'TranscodeJpeg', max_size => 30_000;
$app;
};
Note that in the last example MobileDetector should come first because the conditional check runs in pre-run conditions, which is from
outer to inner: that is, from the top to the bottom in the Builder DSL code.
AUTHOR
Tatsuhiko Miyagawa
Steve Cook
SEE ALSO
Plack::Builder
perl v5.14.2 2012-04-14 Plack::Middleware::Conditional(3pm)