04-07-2010
how to get the specified content of the text into a variable.
I am having one string like
./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
from the above string i need the content that ends with temp/app.env
that means i have to take ./usr1/Server/temp/app.env it into a varible.
the content "./usr1/Server/"may variey from one server to the other so my code is to be generic.
Last edited by dineshmurs; 04-07-2010 at 04:40 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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
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
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
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
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
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
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
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
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
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
LEARN ABOUT DEBIAN
plack::middleware::deflater
Plack::Middleware::Deflater(3pm) User Contributed Perl Documentation Plack::Middleware::Deflater(3pm)
NAME
Plack::Middleware::Deflater - Compress response body with Gzip or Deflate
SYNOPSIS
use Plack::Builder;
builder {
enable sub {
my $app = shift;
sub {
my $env = shift;
my $ua = $env->{HTTP_USER_AGENT} || '';
# Netscape has some problem
$env->{"psgix.compress-only-text/html"} = 1 if $ua =~ m!^Mozilla/4!;
# Netscape 4.06-4.08 have some more problems
$env->{"psgix.no-compress"} = 1 if $ua =~ m!^Mozilla/4.0[678]!;
# MSIE (7|8) masquerades as Netscape, but it is fine
if ( $ua =~ m!MSIE (?:7|8)! ) {
$env->{"psgix.no-compress"} = 0;
$env->{"psgix.compress-only-text/html"} = 0;
}
$app->($env);
}
};
enable "Deflater",
content_type => ['text/css','text/html','text/javascript','application/javascript'],
vary_user_agent => 1;
sub { [200,['Content-Type','text/html'],["OK"]] }
};
DESCRIPTION
Plack::Middleware::Deflater is a middleware to encode your response body in gzip or deflate, based on "Accept-Encoding" HTTP request
header. It would save the bandwidth a little bit but should increase the Plack server load, so ideally you should handle this on the
frontend reverse proxy servers.
This middleware removes "Content-Length" and streams encoded content, which means the server should support HTTP/1.1 chunked response or
downgrade to HTTP/1.0 and closes the connection.
CONFIGURATIONS
content_type
content_type => 'text/html',
content_type => [ 'text/html', 'text/css', 'text/javascript', 'application/javascript', 'application/x-javascript' ]
Content-Type header to apply deflater. if content-type is not defined, Deflater will try to deflate all contents.
vary_user_agent
vary_user_agent => 1
Add "User-Agent" to Vary header.
ENVIRONMENT VALUE
psgix.no-compress
Do not apply deflater
psgix.compress-only-text/html
Apply deflater only if content_type is "text/html"
LICENSE
This software is licensed under the same terms as Perl itself.
AUTHOR
Tatsuhiko Miyagawa
SEE ALSO
Plack, <http://httpd.apache.org/docs/2.2/en/mod/mod_deflate.html>
perl v5.14.2 2012-06-18 Plack::Middleware::Deflater(3pm)