Perl switches (perldoc perlrun):
"-n" reads lines from @ARGV (that is INPUTFILE) to $_ and "-l" removes and adds (when printing) newline chars. "-a" splits $_ to @F array according to a regex from "-F" option
"grep {! RE} @F" filters all elements from the array (elements are strings - "{123, 0, 111}" and so on) where it's not true that 0 is a "word" (not in any numbers like 10, 101, etc.).
Then we join the ready list to a string with ", " as the separator and print it.
I am trying to use a script to replace the header of each file, whose filename are stored within the array $test, using the sed command within a Perl script as follows:
$count = 0;
while ( $count < $#test )
{
`sed -e 's/BIOGRF 321/BIOGRF 332/g' ${test} > 0`;
`cat 0 >... (2 Replies)
Hi,
I am writing a BASH shell script. I have an array that will contain IN ANY ORDER the following elements: DAY 8D MO NS.
I would like to erase the element DAY, but since the order of the elements in the array are random, I will not know which element # DAY is (ie it's not as simple as... (3 Replies)
I have a filr data.txt. Its contents are
Available labels (* indicates activated, I indicates installed, R idicates running): abc-3.0.3 def-3.0.4 xyz-3.1.2-1.0
I want to delete " Available labels (* indicates activated, I indicates installed, R idicates running):"
and... (3 Replies)
Hi,
Is there any way I can grep an array against another array?
Basically here's what I need to do.
There will be an array containing some fixed texts and I have to check whether some files contain these lines. Reading the same files over and over again for each different pattern doesnt seem... (1 Reply)
Hi Everyone,
#!/usr/bin/perl
use strict;
use warnings;
my @test=("a;b;qqq;c;d","a;b;ggg;c;d","a;b;qqq;c;d");
would like to split the @test array into two array:
@test1=(("a;b;qqq;c;d","a;b;qqq;c;d"); and @test2=("a;b;ggg;c;d");
means search for 3rd filed.
Thanks
find the... (0 Replies)
Input:
:: gstreamer
:: xine-lib
:: xine-lib-extras
Output should be:
gstreamer xine-lib xine-lib-extras
How can it be done with sed or perl? (12 Replies)
Hi everyone
I have one question about using array in perl. let say I have several log file in one folder.. example
test1.log
test2.log
test3.log
and the list goes on..
how to make an array for this file? It suppose to detect log file in the current directory and all the log file will... (3 Replies)
I have an array and two variables as below,
I need to check if $datevar is present in $filename.
If so, i need to replace $filename with the values in the array.
I need the output inside an ARRAY
How can this be done.
Any help will be appreciated. Thanks in advance. (2 Replies)
Hi all,
Not sure if this should be in the programming forum, but I believe it will get more response under the Shell Programming and Scripting FORUM.
Am trying to write a customized df script in Perl and need some help with regards to using arrays and file handlers.
At the moment am... (3 Replies)
Discussion started by: newbie_01
3 Replies
LEARN ABOUT DEBIAN
hxcopy
HXCOPY(1) HTML-XML-utils HXCOPY(1)NAME
hxcopy - copy an HTML file and update its relative links
SYNOPSIS
hxcopy [ -i old-URL ] [ -o new-URL ] [ file-or-URL [ file-or-URL ] ]
DESCRIPTION
The hxcopy command copies its first argument to its second argument, while updating relative links. The input is assumed to be HTML or
XHTML and may be slightly reformatted in the process.
If the second argument is omitted, hxcopy writes to standard output. In this case the option -o is required. If the first argument is also
omitted, hxcopy reads from standard input. In this case the option -i is required.
OPTIONS
The following options are supported:
-i old-URL
For the purposes of updating relative links, act as if old-URL is the location from which the input is copied. If this option is
omitted, the actual location of the first argument is used for calculating relative links.
-o new-URL
For the purposed of updating relative links, act as if new-URL is the location to which the input is copied. If this option is
omitted, the actual location of the second argument is used for calculating relative links.
ENVIRONMENT
To use a proxy to retrieve remote files, set the environment variables http_proxy and ftp_proxy. E.g., http_proxy="http://localhost:8080/"
BUGS
Unlike the last argument of cp(1), the last argument of hxcopy must be a file, not a directory.
The second argument must be a local file. Writing to a URL is not yet implemented. To work around this, replace hxcopy file.html
http://example.org/file.html by hxcopy -o http://example.org/file.html file.html tmp.html and then upload tmp.html to the given URL with
some other command, such as curl(1). The first argument, however, may be a URL. hxcopy will download the given file. (Currently only HTTP
is supported.)
EXAMPLE
Assume the HTML file foo.html contains a relative link to "../bar.html". Here are some examples of commands:
hxcopy foo.html bar/foo.html
The file foo.html is copied to ../bar/foo.html and the relative link to "../bar.html" becomes "../../bar.html".
hxcopy foo.html ../foo.html
The file foo.html is copied to ../foo.html and the relative link to "../bar.html" is rewritten as "bar.html".
hxcopy -i http://my.org/dir1/foo.html -o http://my.org/foo.html file1.html file2.html
The file file1.html is copied to file2.html and the relative link to "../bar.html" is rewritten as "bar.html". A command like this
may be useful to update files that are later uploaded to a server.
SEE ALSO cp(1), curl(1), hxwls(1)6.x 9 Dec 2008 HXCOPY(1)