If you always have the same number of fields and the last three fields do not contain commas you can replace your pipeline with just the awk command:
Which will print the fixed URL string you have requested.
If you want the output URL to be based on a URL found in the input file, PLEASE explain what rules are to be used to convert the input URL that can be found in $(NF-3) into the string that you want to be printed instead of the entire URL!
Hi,
i have a function which return a variable .
serach ( paramatere) when i excute this function i get the result in the shell,
i want to print this result in a file by calling just the function.
how can i do it..
the code example is like that:
search ( )
{
..
}
the call... (0 Replies)
i got a data file which contains all the pid,ppid,user,command,pcpu,start_time,status. I wanted to display out the pcpu which is greater than 0.
i uses awk'{if($5 > 0){print}}' filename.txt but is printing out result which not i wanted. Is there any way which i can print out those pcpu which is... (8 Replies)
I'm still beginner and maybe someone can help me.
I have this input:
the great warrior a, b, c
and what i want to know is, with awk, how can i detect the string with 'warrior' string on it and print the a, b, and c seperately, become like this :
Warrior Type
a
b
c
Im still very... (3 Replies)
Hello,
i need help with awk.
I have this file:
cat number
DirB port 67 er_enc_out 0 er_bad_os 0
DirB port 71 er_enc_out 56 er_bad_os 0
DirB port 74 er_enc_out 0 er_bad_os 0
DirB port 75 ... (4 Replies)
Hello....
Pls help me (and sorry my english) :)
So
I have a file (test.txt) with 1 long line.... for example:
isgc jsfh udgf osff 8462 error iwzr 653 idchisfb isfbisfb sihfjfeb isfhsi gcz eifh
How to print after the "error" word the 2nd 4th 5th and 7th word??
output well be:
653 isfbisfb... (2 Replies)
I have a result like this
root@server # grep -rl maldet /etc/cron*
/etc/cron.d/maldet_daily
/etc/cron.d/malcron
/etc/cron.d/malcrondaily
/etc/cron.d/malcronweekly
What I need is, I need an if/else condition such that, if there is any output other than /etc/cron.d/maldet_daily in the... (8 Replies)
I am trying to move files which donot have same filename using
find /Users/ParijatMac/desktop/unix/new_dir -type f -mmin +"$HRS" -exec mv -n "{}" /Users/ParijatMac/desktop/unix/old_dir \; -print
but i am getting all filenames including the ones with duplicate names.Please help me to sort... (5 Replies)
Discussion started by: parijat guh
5 Replies
LEARN ABOUT DEBIAN
mojo::url
Mojo::URL(3pm) User Contributed Perl Documentation Mojo::URL(3pm)NAME
Mojo::URL - Uniform Resource Locator
SYNOPSIS
use Mojo::URL;
# Parse
my $url
= Mojo::URL->new('http://sri:foobar@kraih.com:3000/foo/bar?foo=bar#23');
say $url->scheme;
say $url->userinfo;
say $url->host;
say $url->port;
say $url->path;
say $url->query;
say $url->fragment;
# Build
my $url = Mojo::URL->new;
$url->scheme('http');
$url->userinfo('sri:foobar');
$url->host('kraih.com');
$url->port(3000);
$url->path('/foo/bar');
$url->path('baz');
$url->query->param(foo => 'bar');
$url->fragment(23);
say $url;
DESCRIPTION
Mojo::URL implements a subset of RFC 3986 and RFC 3987 for Uniform Resource Locators with support for IDNA and IRIs.
ATTRIBUTES
Mojo::URL implements the following attributes.
"authority"
my $authority = $url->authority;
$url = $url->authority('root:pass%3Bw0rd@localhost:8080');
Authority part of this URL.
"base"
my $base = $url->base;
$url = $url->base(Mojo::URL->new);
Base of this URL.
"fragment"
my $fragment = $url->fragment;
$url = $url->fragment('foo');
Fragment part of this URL.
"host"
my $host = $url->host;
$url = $url->host('127.0.0.1');
Host part of this URL.
"port"
my $port = $url->port;
$url = $url->port(8080);
Port part of this URL.
"scheme"
my $scheme = $url->scheme;
$url = $url->scheme('http');
Scheme part of this URL.
"userinfo"
my $userinfo = $url->userinfo;
$url = $url->userinfo('root:pass%3Bw0rd');
Userinfo part of this URL.
METHODS
Mojo::URL inherits all methods from Mojo::Base and implements the following new ones.
"new"
my $url = Mojo::URL->new;
my $url = Mojo::URL->new('http://127.0.0.1:3000/foo?f=b&baz=2#foo');
Construct a new Mojo::URL object.
"clone"
my $url2 = $url->clone;
Clone this URL.
"ihost"
my $ihost = $url->ihost;
$url = $url->ihost('xn--bcher-kva.ch');
Host part of this URL in punycode format.
# "xn--da5b0n.net"
Mojo::URL->new('http://X.net')->ihost;
"is_abs"
my $success = $url->is_abs;
Check if URL is absolute.
"parse"
$url = $url->parse('http://127.0.0.1:3000/foo/bar?fo=o&baz=23#foo');
Parse URL.
"path"
my $path = $url->path;
$url = $url->path('/foo/bar');
$url = $url->path('foo/bar');
$url = $url->path(Mojo::Path->new);
Path part of this URL, relative paths will be appended to the existing path, defaults to a Mojo::Path object.
# "http://mojolicio.us/DOM/HTML"
Mojo::URL->new('http://mojolicio.us/perldoc/Mojo')->path('/DOM/HTML');
# "http://mojolicio.us/perldoc/DOM/HTML"
Mojo::URL->new('http://mojolicio.us/perldoc/Mojo')->path('DOM/HTML');
# "http://mojolicio.us/perldoc/Mojo/DOM/HTML"
Mojo::URL->new('http://mojolicio.us/perldoc/Mojo/')->path('DOM/HTML');
"query"
my $query = $url->query;
$url = $url->query(replace => 'with');
$url = $url->query([merge => 'with']);
$url = $url->query({append => 'to'});
$url = $url->query(Mojo::Parameters->new);
Query part of this URL, defaults to a Mojo::Parameters object.
# "2"
Mojo::URL->new('http://mojolicio.us?a=1&b=2')->query->param('b');
# "http://mojolicio.us?a=2&c=3"
Mojo::URL->new('http://mojolicio.us?a=1&b=2')->query(a => 2, c => 3);
# "http://mojolicio.us?a=2&b=2&c=3"
Mojo::URL->new('http://mojolicio.us?a=1&b=2')->query([a => 2, c => 3]);
# "http://mojolicio.us?b=2"
Mojo::URL->new('http://mojolicio.us?a=1&b=2')->query([a => undef]);
# "http://mojolicio.us?a=1&b=2&a=2&c=3"
Mojo::URL->new('http://mojolicio.us?a=1&b=2')->query({a => 2, c => 3});
"to_abs"
my $abs = $url->to_abs;
my $abs = $url->to_abs(Mojo::URL->new('http://kraih.com/foo'));
Clone relative URL and turn it into an absolute one.
"to_rel"
my $rel = $url->to_rel;
my $rel = $url->to_rel(Mojo::URL->new('http://kraih.com/foo'));
Clone absolute URL and turn it into a relative one.
"to_string"
my $string = $url->to_string;
Turn URL into a string.
SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>.
perl v5.14.2 2012-09-05 Mojo::URL(3pm)