Sponsored Content
Full Discussion: help with substitution
Top Forums UNIX for Dummies Questions & Answers help with substitution Post 302333243 by Scott on Saturday 11th of July 2009 11:07:03 PM
Old 07-12-2009
Couple of questions:

1) why would you put something to a prod env. that wasn't tested
2) why would anyone let you if you're not an admin

If all you want is the image (.tif) name, then extract it. You can use awk, sed, cut or whatever to do this.
Code:
awk '{print $1}' file > new_file
cp -f new_file file # cp rather than mv to preserve privileges of original file
rm new_file

I'm guessing
a) that's what you asked
b) I'm too late

Last edited by Scott; 07-12-2009 at 01:30 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

substitution

I am trying to substituted a variable to a file using sed. However, the value of that variable is not being substituted. Here is an example of my code. lf=' ' v_whole="${1} ${2} ${3} $lf" cp ${IPPDIR}/ctl/fax_sub_text_a.${4}.${5}.txt... (1 Reply)
Discussion started by: supercbw
1 Replies

2. UNIX for Dummies Questions & Answers

Need help in substitution!!!!

In a file I want to globally change a "|" charater by a new line character. I am using the command 1,$s/\|/??/g Can anybody say what should I put in place of ?? in the above command? (3 Replies)
Discussion started by: uLearner
3 Replies

3. Shell Programming and Scripting

Substitution using SED

Hi , I am stuck up in the below scenario:- I need to read a file name (eg A.txt) name frm another file (eg B.txt) and then I need to search for a particular expression in A.txt and substitute it with another expression. How can I use SED inside SHELL Scripting and command prompt as... (2 Replies)
Discussion started by: shubhranshu
2 Replies

4. Shell Programming and Scripting

SED Substitution

Hi , I am stuck up in the below scenario:- I need to read a file name (eg A.txt) name frm another file (eg B.txt) and then I need to search for a particular expression in A.txt and substitute it with another expression. How can I use SED inside SHELL Scripting and command prompt as well to... (1 Reply)
Discussion started by: shubhranshu
1 Replies

5. Shell Programming and Scripting

Difference between "Command substitution" and "Process substitution"

Hi, What is the actual difference between these two? Why the following code works for process substitution and fails for command substitution? while IFS= read -r line; do echo $line; done < <(cat file)executes successfully and display the contents of the file But, while IFS='\n' read -r... (3 Replies)
Discussion started by: royalibrahim
3 Replies

6. Shell Programming and Scripting

Substitution

All, I have this text document that contains a listing(See below). What i would like to ask is how i could extract just the information i need which is the files name (CWS*****.***.gz) If anyone has any suggestions i would be very grateful. I am sure its relatively simple but i just... (6 Replies)
Discussion started by: Andyp2704
6 Replies

7. Shell Programming and Scripting

substitution help

How do i substitute ' with space in a file using sed or awk i am getting the following two scenarios 1) xyz'd with xyz d if i use sed 's/xyz\\\'d/xy z/g' it is taking ' after \ as closing expr for substitution 2) xyz';d with xyz d please advice (8 Replies)
Discussion started by: mad_man12
8 Replies

8. Shell Programming and Scripting

vi substitution

Hello, I'm trying to do a substitution in vi. which adds a field for the year to a line. If the line doesnt include a year, it should still add a field (although empty) the fields are: Country:number:number:name(and sometimes year):place this is a desired in and output: Sweden:55:32:John... (2 Replies)
Discussion started by: drareeg
2 Replies

9. UNIX for Dummies Questions & Answers

vi substitution help

Hi experts, Could someone help me how to figure out the following substitution? I copied and pasted a column of names from an Excel file into another file in vi. The column of data has last names with dash (hyphens) and apostrophes. My goal is to do the following: 1) remove the apostrophes... (10 Replies)
Discussion started by: onlinelearner02
10 Replies

10. Shell Programming and Scripting

Substitution

I am trying to do some substitutions using the substitution operator (:%s) in a text file. I want to replace all A1, A2, A3.......A100 in my text file. I used :%s/A2/SAE/g successfully until A9 but when I use A1, all the A11 to A19 is changed. How do I specify the exact match here? (8 Replies)
Discussion started by: Kanja
8 Replies
install::TempContent::Objects::mod_perl-2.0.9::docs::apiUseraContrinstall::TempContent::Objects::mod_perl-2.0.9::docs::api::Apache2::SubRequest(3)

NAME
Apache2::SubRequest - Perl API for Apache subrequests Synopsis use Apache2::SubRequest (); # run internal redirects at once $r->internal_redirect($new_uri); $r->internal_redirect_handler($new_uri); # create internal redirect objects $subr = $r->lookup_uri("/foo"); $subr = $r->lookup_method_uri("GET", "/tmp/bar") $subr = $r->lookup_file("/tmp/bar"); # optionally manipulate the output through main request filters $subr = $r->lookup_uri("/foo", $r->output_filters); # now run them my $rc = $subr->run; Description "Apache2::SubRequest" contains API for creating and running of Apache sub-requests. "Apache2::SubRequest" is a sub-class of "Apache2::RequestRec object". API
"Apache2::SubRequest" provides the following functions and/or methods: "DESTROY" Free the memory associated with a sub request: undef $subr; # but normally don't do that obj: $subr ( "Apache2::SubRequest object" ) The sub request to finish ret: no return value since: 2.0.00 "DESTROY" is called automatically when $subr goes out of scope. If you want to free the memory earlier than that (for example if you run several subrequests), you can "undef" the object as: undef $subr; but never call "DESTROY" explicitly, since it'll result in "ap_destroy_sub_req" being called more than once, resulting in multiple brain injuries and certain hair loss. "internal_redirect" Redirect the current request to some other uri internally $r->internal_redirect($new_uri); obj: $r ( "Apache2::RequestRec object" ) The current request arg1: $new_uri ( string ) The URI to replace the current request with ret: no return value since: 2.0.00 In case that you want some other request to be served as the top-level request instead of what the client requested directly, call this method from a handler, and then immediately return "Apache2::Const::OK". The client will be unaware the a different request was served to her behind the scenes. "internal_redirect_handler" Identical to "internal_redirect", plus automatically sets "$r->content_type" is of the sub-request to be the same as of the main request, if "$r->handler" is true. $r->internal_redirect_handler($new_uri); obj: $r ( "Apache2::RequestRec object" ) The current request arg1: $new_uri ( string ) The URI to replace the current request with. ret: no return value since: 2.0.00 This function is designed for things like actions or CGI scripts, when using "AddHandler", and you want to preserve the content type across an internal redirect. "lookup_file" Create a subrequest for the given file. This sub request can be inspected to find information about the requested file $ret = $r->lookup_file($new_file); $ret = $r->lookup_file($new_file, $next_filter); obj: $r ( "Apache2::RequestRec object" ) The current request arg1: $new_file ( string ) The file to lookup opt arg2: $next_filter ( "Apache2::Filter" ) See "$r->lookup_uri" for details. ret: $ret ( "Apache2::SubRequest object" ) The sub request record. since: 2.0.00 See "$r->lookup_uri" for further discussion. "lookup_method_uri" Create a sub request for the given URI using a specific method. This sub request can be inspected to find information about the requested URI $ret = $r->lookup_method_uri($method, $new_uri); $ret = $r->lookup_method_uri($method, $new_uri, $next_filter); obj: $r ( "Apache2::RequestRec object" ) The current request arg1: $method ( string ) The method to use in the new sub request (e.g. "GET") arg2: $new_uri ( string ) The URI to lookup opt arg3: $next_filter ( "Apache2::Filter object" ) See "$r->lookup_uri" for details. ret: $ret ( "Apache2::SubRequest object" ) The sub request record. since: 2.0.00 See "$r->lookup_uri" for further discussion. "lookup_uri" Create a sub request from the given URI. This sub request can be inspected to find information about the requested URI. $ret = $r->lookup_uri($new_uri); $ret = $r->lookup_uri($new_uri, $next_filter); obj: $r ( "Apache2::RequestRec object" ) The current request arg1: $new_uri ( string ) The URI to lookup opt arg2: $next_filter ( "Apache2::Filter object" ) The first filter the subrequest should pass the data through. If not specified it defaults to the first connection output filter for the main request "$r->proto_output_filters". So if the subrequest sends any output it will be filtered only once. If for example you desire to apply the main request's output filters to the sub-request output as well pass "$r->output_filters" as an argument. ret: $ret ( "Apache2::SubRequest object" ) The sub request record since: 2.0.00 Here is an example of a simple subrequest which serves uri /new_uri: sub handler { my $r = shift; my $subr = $r->lookup_uri("/new_uri"); $subr->run; return Apache2::Const::OK; } If let's say you have three request output filters registered to run for the main request: PerlOutputFilterHandler MyApache2::SubReqExample::filterA PerlOutputFilterHandler MyApache2::SubReqExample::filterB PerlOutputFilterHandler MyApache2::SubReqExample::filterC and you wish to run them all, the code needs to become: my $subr = $r->lookup_uri("/new_uri", $r->output_filters); and if you wish to run them all, but the first one ("filterA"), the code needs to be adjusted to be: my $subr = $r->lookup_uri("/new_uri", $r->output_filters->next); "run" Run a sub-request $rc = $subr->run(); obj: $subr ( "Apache2::RequestRec object" ) The sub-request (e.g. returned by "lookup_uri") ret: $rc ( integer ) The return code of the handler ("Apache2::Const::OK", "Apache2::Const::DECLINED", etc.) since: 2.0.00 Unsupported API "Apache2::SubRequest" also provides auto-generated Perl interface for a few other methods which aren't tested at the moment and therefore their API is a subject to change. These methods will be finalized later as a need arises. If you want to rely on any of the following methods please contact the the mod_perl development mailing list so we can help each other take the steps necessary to shift the method to an officially supported API. "internal_fast_redirect" META: Autogenerated - needs to be reviewed/completed Redirect the current request to a sub_req, merging the pools $r->internal_fast_redirect($sub_req); obj: $r ( "Apache2::RequestRec object" ) The current request arg1: $sub_req ( string ) A subrequest created from this request ret: no return value since: 2.0.00 META: httpd-2.0/modules/http/http_request.c declares this function as: /* XXX: Is this function is so bogus and fragile that we deep-6 it? */ do we really want to expose it to mod_perl users? "lookup_dirent" META: Autogenerated - needs to be reviewed/completed Create a sub request for the given apr_dir_read result. This sub request can be inspected to find information about the requested file $lr = $r->lookup_dirent($finfo); $lr = $r->lookup_dirent($finfo, $subtype); $lr = $r->lookup_dirent($finfo, $subtype, $next_filter); obj: $r ( "Apache2::RequestRec object" ) The current request arg1: $finfo ( "APR::Finfo object" ) The apr_dir_read result to lookup arg2: $subtype ( integer ) What type of subrequest to perform, one of; Apache2::SUBREQ_NO_ARGS ignore r->args and r->path_info Apache2::SUBREQ_MERGE_ARGS merge r->args and r->path_info arg3: $next_filter ( integer ) The first filter the sub_request should use. If this is NULL, it defaults to the first filter for the main request ret: $lr ( "Apache2::RequestRec object" ) The new request record since: 2.0.00 META: where do we take the apr_dir_read result from? See Also mod_perl 2.0 documentation. Copyright mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0. Authors The mod_perl development team and numerous contributors. perl v5.18.2 install::TempContent::Objects::mod_perl-2.0.9::docs::api::Apache2::SubRequest(3)
All times are GMT -4. The time now is 04:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy