Well, although a parser is not simply done but usually an intricate piece of software, here is
- a bash script
- replacing ALL kind of URLs (abc.com; def.org; ghi.de; ...)
- only in "appMar" section
As the URL can assume any shape, we can't rely on a string constant ("URLnn") but need to check for the file structure (the URL is the first entry in the second nesting level).
Try
This is just straightforward functionality to prove it's working, there's nothing extra like error checking or debugging. If need be, this is left to the reader.
I need help with a perl parsing script. I have some error logs on a windows machine that I need to parse from a text file, but I know nothing about perl. I usually run this bash script on my linux box and it does just what I need. How would I do the same thing with perl and port it to my windows... (2 Replies)
okay i'm going to try to say this uber-simple:
I use dropbox (file-sync service). in order for dropbox sync files, they must be its children eg. somewhere under /home/jzacsh/Dropbox].
I want to now use it to keep my development files in sync across my machines:
easy: just move my dev. files... (2 Replies)
Hi all!
Looking for some help parsing filenames in bash. I have a directory full of files named "livingroom-110111105637.avi". The format is always date and time (yymmddhhmmss). I'm looking to parse the filenames so they are a little more easily readable. Maybe rename them to... (4 Replies)
Hello dear users, here I have a script to manipulate .csv files that are like this originally:
And I need to make a script to delete certain fields. Each field is separated with a comma.
So, here is my script (at least a part of it):
Field $1 is composed of a name, and then a... (5 Replies)
I would like to setup a script that pulls in time/date in two seperate columns, and then name the other columns as listed below:
Column1=Art/TJ output
Column2=Art/TJ output
Column3=TJ output
column4=Art output
Column5=If time/date past 12:00 noon -fail
Colume6=If time/date before... (1 Reply)
Hello,
I would like to modify an existing script of mine that uses a manually defined "MCVERSION" variable and make it define that variable instead based on this JSON file stored online:
https://s3.amazonaws.com/Minecraft.Download/versions/versions.json
Within that JSON, I 'm looking for... (4 Replies)
Hi everyone,
I'm trying to write my first ever shell script, the OS is Raspbian. The code I have written must be executed whenever a certain database has been modified. The database resides on a Windows server to which I have a mount point, and I have no control over the Windows server at all so... (2 Replies)
All,
Have a weird issue where i need to generate a report from GitHub monthly detailing user accounts and the last time they logged in. I'm using a windows box to do this (work issued) and would like to know if anyone has any experience scripting for GitAPI using windows / cygwin / powershell?... (9 Replies)
Hello guys,
I want to parse a JSON file in order to get the data in a table form.
My JSON file is like this:
{
"document":{
"page":
},
{
"column":
}
]
},
{
... (6 Replies)
Hello.
I'm new to bash script and I'm learning the basics by writing some scripts.
Recently a friend of mine asked me if I could try to write a script to him to automate a couple of processes that uses JSON RPCs.
I'll try to explain in few words the workflow just to contextualize the problem.... (48 Replies)
Discussion started by: psysc0rpi0n
48 Replies
LEARN ABOUT SUSE
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.12.1 2008-11-13 Template::Plugin::URL(3)