03-19-2010
Thanks
That works perfectly
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi ,
I have a script where i will remove header and trailer record and ftp to another server.
I'm using the code:
latestfilename=`ls filename_* | tail -1`
echo "Latest filename = $latestfilename"
sed '1d;$d' $latestfilename > a.ftpedfile
I have an issue if input data is having null... (1 Reply)
Discussion started by: ammu
1 Replies
2. Shell Programming and Scripting
hi all,
iam new to this forum.i have to submit the script EOD.so please help me.
my requirement is to compare two null values..iam trying to compare two null values :One null value output of the storedprocedure and another iam giving spaces in script.
it is giving the error... (11 Replies)
Discussion started by: bbc17484
11 Replies
3. Shell Programming and Scripting
I have a huge file with 20 fileds in each record and each field is seperated by "|". If i want to get all the reocrds that have 18th or for that matter any filed as null how can i do it? Please let me know (3 Replies)
Discussion started by: dsravan
3 Replies
4. UNIX for Dummies Questions & Answers
Hi All,
I have a file with 10 columns and get the required data for nine columns properly except 8th. In 8th column i have both NULL and NON NULL values...i.e
certain records have values for all the columns including 8th column and certain records have 8th column as NULL.My requisite is,without... (20 Replies)
Discussion started by: ganesh_248
20 Replies
5. UNIX for Advanced & Expert Users
Hi,
Can someone help me comparing Null values.
Scenario is as follows:
I have a variable which "cache_prd" which can have either some integer or nothing(Null)
if it is integer I have to again do some comparision but these comparisons give me this error:( "line 32: [: 95: unary operator... (3 Replies)
Discussion started by: Yagami
3 Replies
6. Shell Programming and Scripting
Hi all,
I want to compute for the average of a file with null values (NaN) for each row. any help on how to do it. the sample file looks like this.
1.4 1.2 1.5 NaN 1.6
1.3 1.1 NaN 1.3 NaN
2.4 1.3 1.5 NaN 1.5
NaN 1.2 NaN 1.4 NaN
I need to do a row-wise averaging such that it will sum only... (14 Replies)
Discussion started by: ida1215
14 Replies
7. Shell Programming and Scripting
Hello everyone
I am doing a join command. Obviously, before I need two files sorted first. ( Both files have headers and have about 2 million lines each one )
The problem is, one of the files has null values in the key to sort (which is the first filed ). For example I have the original... (4 Replies)
Discussion started by: viktor1985
4 Replies
8. Shell Programming and Scripting
I am using below code to validate the source file,code working fine but if any column contains null value then below code throwing error actually it should not.how to customize the below code to handle null null values also.
When I run the script with below source data getting “date error”, as... (2 Replies)
Discussion started by: srivalli
2 Replies
9. Shell Programming and Scripting
hi,
I had a small question.I had a file from which i need to extract data.
I have written the below script to check if the file exists and if it exists extract requierd columns from the file.
IFILE=/home/home01/Report_1.csv
OFILE=/home/home01/name.csv.out1
if #Checks if file exists... (1 Reply)
Discussion started by: Vivekit82
1 Replies
10. Shell Programming and Scripting
Hi,
I have a csv file with given details
abc.txt
123,ra,point,,there
232,ba,points,home,pheer
I want to get those values and store them in different variables:
Code:
while read line
do
echo $line |awk -F"," '{print $1" "$2" "$3" "$4" "$5"}'|read dbt_acct val_dt crncy AMT... (11 Replies)
Discussion started by: rahulsk
11 Replies
LEARN ABOUT DEBIAN
cgi::emulate::psgi
CGI::Emulate::PSGI(3pm) User Contributed Perl Documentation CGI::Emulate::PSGI(3pm)
NAME
CGI::Emulate::PSGI - PSGI adapter for CGI
SYNOPSIS
my $app = CGI::Emulate::PSGI->handler(sub {
# Existing CGI code
});
DESCRIPTION
This module allows an application designed for the CGI environment to run in a PSGI environment, and thus on any of the backends that PSGI
supports.
It works by translating the environment provided by the PSGI specification to one expected by the CGI specification. Likewise, it captures
output as it would be prepared for the CGI standard, and translates it to the format expected for the PSGI standard using CGI::Parse::PSGI
module.
CGI.pm
If your application uses CGI, be sure to cleanup the global variables in the handler loop yourself, so:
my $app = CGI::Emulate::PSGI->handler(sub {
use CGI;
CGI::initialize_globals();
my $q = CGI->new;
# ...
});
Otherwise previous request variables will be reused in the new requests.
Alternatively, you can install and use CGI::Compile from CPAN and compiles your existing CGI scripts into a sub that is perfectly ready to
be converted to PSGI application using this module.
my $sub = CGI::Compile->compile("/path/to/script.cgi");
my $app = CGI::Emulate::PSGI->handler($sub);
This will take care of assigning an unique namespace for each script etc. See CGI::Compile for details.
You can also consider using CGI::PSGI but that would require you to slightly change your code from:
my $q = CGI->new;
# ...
print $q->header, $output;
into:
use CGI::PSGI;
my $app = sub {
my $env = shift;
my $q = CGI::PSGI->new($env);
# ...
return [ $q->psgi_header, [ $output ] ];
};
See CGI::PSGI for details.
METHODS
handler
my $app = CGI::Emulate::PSGI->handler($code);
Creates a PSGI application code reference out of CGI code reference.
emulate_environment
my %env = CGI::Emulate::PSGI->emulate_environment($env);
Creates an environment hash out of PSGI environment hash. If your code or framework just needs an environment variable emulation, use
this method like:
local %ENV = (%ENV, CGI::Emulate::PSGI->emulate_environment($env));
# run your application
If you use "handler" method to create a PSGI environment hash, this is automatically called in the created application.
AUTHOR
Tokuhiro Matsuno <tokuhirom@cpan.org>
Tatsuhiko Miyagawa
COPYRIGHT AND LICENSE
Copyright (c) 2009-2010 by tokuhirom.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
SEE ALSO
PSGI CGI::Compile CGI::PSGI Plack CGI::Parse::PSGI
perl v5.14.2 2012-03-18 CGI::Emulate::PSGI(3pm)