find a word in a file, and change a word beneath it ??
Hi all,
I have a file with lines written somewhat like this.
I would like to search word police (which is in middle of file)
and then change the line from browse = no to browse = yes which is after two lines from the word police.
Greetings.
I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file.
I'm struggling to see how each line can be... (5 Replies)
Hi,
I am writing a script where, i want to parse through $JAVA_OPTS, if it finds the word -cleint it should return "no change needed" or else it should print "change needed".
I tried a lot, but could not get the proper output. I am new to unix shell. If u guys can guide me it would be of gr8... (4 Replies)
File having data in following format :
file name : file.txt
--------------------
111111;name1
222222;name2
333333;name3
I want to read this file so that I can split these into two paramaters i.e. 111111 & name1 into two different variables(say value1 & value2).
i.e val1=11111 &... (2 Replies)
Hi Everyone,
I am looking for a simple way for replacing all the files under a directory that use the server "xsgd1234dap" with "xsdr3423pap".
For Example:
In the Directory,
$pwd
/home/nick
$ grep -l "xsgd1234dap" *.sh | wc -l
119
I have "119" files that are still using... (5 Replies)
I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL.
I need the whole word... (6 Replies)
hi all, I'm new there, I'm just playing with perl and lwp and I just successfully created a script for log in to a web site with post. I have a response but I would like to have something like this:
I have in my response lines like:
<div class="sender">mimi020</div>
<some html code.....>... (3 Replies)
Hi All,
I have a XML file which is looks like as below. <<please see the attachment >>
<?xml version="1.0" encoding="UTF-8"?>
<esites>
<esite>
<name>XXX.com</name>
<storeId>10001</storeId>
<module>
... (4 Replies)
Hi,
I have a sample file as shown below, I am looking for sed or any command which prints the complete word only from the input file.
Ex:
$ cat "sample.log"
I am searching for a word which is present in this file
We can do a pattern search using grep but I need to cut only the word which... (1 Reply)
Hi All,
I am looking for a perl/awk/sed command to auto-increment the numbers line in file, P1.tcl:
run_build_model sparc_ifu_dec
run_drc
set_faults -model path_delay -atpg_effectiveness -fault_coverage
add_delay_paths P1
set_atpg -abort_limit 1000
run_atpg -ndetects 1000
I would like... (6 Replies)
I am trying to figure out to find word count of each word from my file
sample file
hi how are you
hi are you ok
sample out put
hi 1
how 1
are 1
you 1
hi 1
are 1
you 1
ok 1
wc -l filename is not helping , i think we will have to split the lines and count and then print and also... (4 Replies)
Discussion started by: mirwasim
4 Replies
LEARN ABOUT CENTOS
template::plugin::url
Template::Plugin::URL(3) User Contributed Perl Documentation Template::Plugin::URL(3)NAME
Template::Plugin::URL - Plugin to construct complex URLs
SYNOPSIS
[% USE url('/cgi-bin/foo.pl') %]
[% url(debug = 1, id = 123) %]
# ==> /cgi/bin/foo.pl?debug=1&id=123
[% USE mycgi = url('/cgi-bin/bar.pl', mode='browse', debug=1) %]
[% mycgi %]
# ==> /cgi/bin/bar.pl?mode=browse&debug=1
[% mycgi(mode='submit') %]
# ==> /cgi/bin/bar.pl?mode=submit&debug=1
[% mycgi(debug='d2 p0', id='D4-2k[4]') %]
# ==> /cgi-bin/bar.pl?mode=browse&debug=d2%20p0&id=D4-2k%5B4%5D
DESCRIPTION
The "URL" plugin can be used to construct complex URLs from a base stem and a hash array of additional query parameters.
The constructor should be passed a base URL and optionally, a hash array reference of default parameters and values. Used from with a
template, it would look something like the following:
[% USE url('http://www.somewhere.com/cgi-bin/foo.pl') %]
[% USE url('/cgi-bin/bar.pl', mode='browse') %]
[% USE url('/cgi-bin/baz.pl', mode='browse', debug=1) %]
When the plugin is then called without any arguments, the default base and parameters are returned as a formatted query string.
[% url %]
For the above three examples, these will produce the following outputs:
http://www.somewhere.com/cgi-bin/foo.pl
/cgi-bin/bar.pl?mode=browse
/cgi-bin/baz.pl?mode=browse&debug=1
Note that additional parameters are separated by '"&"' rather than simply '"&"'. This is the correct behaviour for HTML pages but is,
unfortunately, incorrect when creating URLs that do not need to be encoded safely for HTML. This is likely to be corrected in a future
version of the plugin (most probably with TT3). In the mean time, you can set $Template::Plugin::URL::JOINT to "&" to get the correct
behaviour.
Additional parameters may be also be specified to the URL:
[% url(mode='submit', id='wiz') %]
Which, for the same three examples, produces:
http://www.somewhere.com/cgi-bin/foo.pl?mode=submit&id=wiz
/cgi-bin/bar.pl?mode=browse&id=wiz
/cgi-bin/baz.pl?mode=browse&debug=1&id=wiz
A new base URL may also be specified as the first option:
[% url('/cgi-bin/waz.pl', test=1) %]
producing
/cgi-bin/waz.pl?test=1
/cgi-bin/waz.pl?mode=browse&test=1
/cgi-bin/waz.pl?mode=browse&debug=1&test=1
The ordering of the parameters is non-deterministic due to fact that Perl's hashes themselves are unordered. This isn't a problem as the
ordering of CGI parameters is insignificant (to the best of my knowledge). All values will be properly escaped thanks to some code
borrowed from Lincoln Stein's "CGI" module. e.g.
[% USE url('/cgi-bin/woz.pl') %]
[% url(name="Elrich von Benjy d'Weiro") %]
Here the spaces and ""'"" character are escaped in the output:
/cgi-bin/woz.pl?name=Elrich%20von%20Benjy%20d%27Weiro
An alternate name may be provided for the plugin at construction time as per regular Template Toolkit syntax.
[% USE mycgi = url('cgi-bin/min.pl') %]
[% mycgi(debug=1) %]
AUTHOR
Andy Wardley <abw@wardley.org> <http://wardley.org/>
COPYRIGHT
Copyright (C) 1996-2007 Andy Wardley. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
Template::Plugin
perl v5.16.3 2011-12-20 Template::Plugin::URL(3)