Lets assume (assume since you have not given complete names and detaios properly)
Your list file name is: img_list.txt whose content is something alike:
Your source directory: /home/user/images/
Your img file names are generally of this form: 11111.jpg Destination Directory: /home/user/newimages/
I have list of files named file_username_051208_025233.log. Here 051208 is the date and 025233 is the time.I have to run thousands of files daily.I want to put all the files depending on the date of running into a date directory.Suppose if we run files today they should put into 05:Dec:08... (3 Replies)
Please do help me out with this. I have to write the following script.
There is a directory named "storage_directory" and it has hundreds of files in it. My script has to move each file from the storage_directory to "temp_directory" After moving each file, it has to create a log of the File... (4 Replies)
Hi,
I have a data file that lists a number of files. I want to move the files named in that one to another directory. Here's what I have:
#!/usr/bin/perl -w
open(FILE, "<collision.txt");
my @lines=<FILE>;
foreach my $lines (@lines) {
system("mv $lines collisions/.");
}
close(FILE);
... (2 Replies)
Hi folks
I need to write a shell script to check whether source and the destination has the same files. The source and destination are over two servers and connecting through ssh. It should even compare the date i.e, the complete file name, date stamp and size should match. Should list out all the... (3 Replies)
Hi All,
I am coding for a requirement where I need to read a file & get the values of SUB_DATE. Once the dates are found, i need to move the files based on these dates from one directory to another.
ie, this is how it will be in the file,
SUB_DATE = 20120608,20120607,20120606,20120606... (5 Replies)
Hi All,
i need to move all files in a directory to some other directory and need to archive them,,,
Ex.. Source_Path/my_directory/
files in it are... acw.csv
123.txt
bge.dat etc ..and we dont know how many files does my_directory contains and all are with different extensions ..so i need... (6 Replies)
Hi all,
Please help me creating a job that runs on every monday.
And the job must have a script to move the files from directory1 to directory2 based on date.
eg: directory1 = usr/appl/src/archive; directory2 = usr/appl/failed
filename : PHDG_90021.txt
when the job runs,it must move... (1 Reply)
Hi,
Could you please assist how to move the gz files which are older than the 90 days from one folder to another folder ,before that it need to check the file system named "nfs" if size is less than 90 or not. If size is above 90 then it shouldn't perform file move and exit the script throwing... (4 Replies)
Given a directory containing say a few thousand files,
please output a list of all the names of the files in the directory that are exactly the same, i.e. have the same contents.
func(a_directory_name) output -> {“matches”: , ... ]}
e.g. func(“/home/my/files”) where the directory... (7 Replies)
Discussion started by: anuragpgtgerman
7 Replies
LEARN ABOUT DEBIAN
html::linkextor
HTML::LinkExtor(3pm) User Contributed Perl Documentation HTML::LinkExtor(3pm)NAME
HTML::LinkExtor - Extract links from an HTML document
SYNOPSIS
require HTML::LinkExtor;
$p = HTML::LinkExtor->new(&cb, "http://www.perl.org/");
sub cb {
my($tag, %links) = @_;
print "$tag @{[%links]}
";
}
$p->parse_file("index.html");
DESCRIPTION
HTML::LinkExtor is an HTML parser that extracts links from an HTML document. The HTML::LinkExtor is a subclass of HTML::Parser. This means
that the document should be given to the parser by calling the $p->parse() or $p->parse_file() methods.
$p = HTML::LinkExtor->new
$p = HTML::LinkExtor->new( $callback )
$p = HTML::LinkExtor->new( $callback, $base )
The constructor takes two optional arguments. The first is a reference to a callback routine. It will be called as links are found. If
a callback is not provided, then links are just accumulated internally and can be retrieved by calling the $p->links() method.
The $base argument is an optional base URL used to absolutize all URLs found. You need to have the URI module installed if you provide
$base.
The callback is called with the lowercase tag name as first argument, and then all link attributes as separate key/value pairs. All
non-link attributes are removed.
$p->links
Returns a list of all links found in the document. The returned values will be anonymous arrays with the following elements:
[$tag, $attr => $url1, $attr2 => $url2,...]
The $p->links method will also truncate the internal link list. This means that if the method is called twice without any parsing
between them the second call will return an empty list.
Also note that $p->links will always be empty if a callback routine was provided when the HTML::LinkExtor was created.
EXAMPLE
This is an example showing how you can extract links from a document received using LWP:
use LWP::UserAgent;
use HTML::LinkExtor;
use URI::URL;
$url = "http://www.perl.org/"; # for instance
$ua = LWP::UserAgent->new;
# Set up a callback that collect image links
my @imgs = ();
sub callback {
my($tag, %attr) = @_;
return if $tag ne 'img'; # we only look closer at <img ...>
push(@imgs, values %attr);
}
# Make the parser. Unfortunately, we don't know the base yet
# (it might be different from $url)
$p = HTML::LinkExtor->new(&callback);
# Request document and parse it as it arrives
$res = $ua->request(HTTP::Request->new(GET => $url),
sub {$p->parse($_[0])});
# Expand all image URLs to absolute ones
my $base = $res->base;
@imgs = map { $_ = url($_, $base)->abs; } @imgs;
# Print them out
print join("
", @imgs), "
";
SEE ALSO
HTML::Parser, HTML::Tagset, LWP, URI::URL
COPYRIGHT
Copyright 1996-2001 Gisle Aas.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2011-10-15 HTML::LinkExtor(3pm)