Sponsored Content
Top Forums Shell Programming and Scripting how to get the specified content of the text into a variable. Post 302410889 by vino on Wednesday 7th of April 2010 05:27:00 AM
Old 04-07-2010
Quote:
Originally Posted by dineshmurs
Thanks for your replay.After using the above cmd i am getting the following error
Error
====
No such file or directory
Test1.sh[21]: ./usr1/Server/temp/app.env ./usr1/Server/temp/upp/app.env ./usr1/Server/ORIG_temp/app.env ./usr1/Server/ORIG_temp/upp/app.env ./usr1/Server/work_temp_40/app.env ./usr1/Server/work_temp_40/upp/app.env ./usr1/fd/app.env ./usr1/PurgeArchive/app.env ./usr1/bm/bin/app.env ./usr1/apps/bin/app.env ./usr1/apps/ORIG_bin/app.env: cannot open


For your reference i am pasting the code

Code
======
find_name=$(find . -name "app.env");
var=$(tr ' ' "\n" < $find_name| grep "\/temp\/app.env")
Please post the entire script.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to replace a variable content

Hi, variable1="This is a car" Now I want to replace the content of variable1, "car" to "dog". Is there any simple command I can use. Thanks. Joseph (4 Replies)
Discussion started by: josephwong
4 Replies

2. Shell Programming and Scripting

Content of Content of a variable!

I got a sample BASH script like this : $ cat test MYVAR=$1 DUMMY1="This is tricky" DUMMY2=24 echo $ $ ./test DUMMY1 ./test: line 5: This is tricky: syntax error in expression (error token is "is tricky") **I was expecting the output as "This is tricky", ah! but no luck **But... (2 Replies)
Discussion started by: jaduks
2 Replies

3. Shell Programming and Scripting

Content of variable

I have a variable that contains filenames like this: variable="file_1.extension<blank>file_2.extension<blank>file_3.extension<blank>file_4.extension and so on" How can I make filenames to be separated by newline: (I tried Sed but it didn't worked well) file_1.extension file_2.extension... (6 Replies)
Discussion started by: MartyIX
6 Replies

4. Shell Programming and Scripting

addressing variable content...

I want to address a variable content whose name is/matches the content of a given other variable. i.e. set name=´sam´ set ${name}_age=´27´ So, by typing: echo ${name}_age I correctly obtain: sam_age By typing: echo $sam_age or echo ${sam_age} I correctly obtain: 27 But how can I... (3 Replies)
Discussion started by: sobolev
3 Replies

5. Shell Programming and Scripting

How to get content of a variable into text file (sed)?

Hello, Im working on this problem for 3 days now and i just cant get it to work.. I tried with alot of different sed methods but didnt find any solution. Its proberly verry simple but i just started bash scripting for a month or so.. i have a file called: file.nfo and file.txt the content... (4 Replies)
Discussion started by: atmosroll
4 Replies

6. Shell Programming and Scripting

How to put content of file into a variable?

For example, I have a simple text file note: this a note a simple note a very very simple notewhen I use this command, temp=$(cat "note.txt")then I echo temp, the result is in one line. echo $temp note: this a note a simple note a very very simple noteMy variable doesn't have newline. How... (7 Replies)
Discussion started by: 14th
7 Replies

7. Shell Programming and Scripting

Loop over variable content

Hello all, I do have a variable containing one line like this: Waiting for job XXXXXX to start I needed to get the 'XXXXXX' literal, so I did the following: job_interno=`echo $log_exec | sed 's/.*Waiting for job \(*\).*/\1/' ` #other stuff Now, my variable is have more... (5 Replies)
Discussion started by: manolain
5 Replies

8. Shell Programming and Scripting

Script to create a text file whose content is the text of another files

Hello everyone, I work under Ubuntu 11.10 (c-shell) I need a script to create a new text file whose content is the text of another text files that are in the directory $DIRMAIL at this moment. I will show you an example: - On the one hand, there is a directory $DIRMAIL where there are... (1 Reply)
Discussion started by: tenteyu
1 Replies

9. UNIX for Dummies Questions & Answers

Getting ls content into a file using variable

hi i just cant figure out how can i do this ls -lt > log.txt using $PWD what i mean is how can i get the ls command content into a file using $PWD variable? :confused: (4 Replies)
Discussion started by: chinababy
4 Replies

10. Shell Programming and Scripting

Replacement of variable by their content in a file

Dear all, I have a "SQL request" in a file: that request include different "host variable" and I would like to substitute the different "host variable" by their respective content before executing the request. For example: $ echo $SHELL /bin/bash $ cat dae2.txt DELETE FROM ... (11 Replies)
Discussion started by: dae
11 Replies
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)
All times are GMT -4. The time now is 05:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy