pipe multiple pages in lynx

pipe multiple pages in lynx

am 08.01.2006 06:58:07 von sheller

I wish to add the contents of the follwing two or many
pages into one (say through piping) at one
stroke, without storing in any temporary file.
Any idea please? Thanks.

#!/bin/bash
lynx -dump http://www/stocks/a.htm
lynx -dump http://www/stocks/b.htm


-arasu

Re: pipe multiple pages in lynx

am 08.01.2006 07:20:47 von matt_left_coast

sheller wrote:

> I wish to add the contents of the follwing two or many
> pages into one (say through piping) at one
> stroke, without storing in any temporary file.
> Any idea please? Thanks.
>
> #!/bin/bash
> lynx -dump http://www/stocks/a.htm
> lynx -dump http://www/stocks/b.htm
>
>
> -arasu
#!/bin/bash
lynx -dump http://www/stocks/a.htm > out.file
lynx -dump http://www/stocks/b.htm >> out.file
lynx -dump http://www/stocks/c.htm >> out.file

A single '>' creates a new file if none exists or overwrites an existing
file. The ">>" creates a new file if none exists or *appends* an existing
file. So, the first line would clear out any file from when the script was
run before and write only a.htm the other lines append to the existing
file.

--

Re: pipe multiple pages in lynx

am 08.01.2006 12:35:44 von gazelle

In article ,
matt_left_coast wrote:
>sheller wrote:
>
>> I wish to add the contents of the follwing two or many
>> pages into one (say through piping) at one
>> stroke, without storing in any temporary file.
>> Any idea please? Thanks.
....
>#!/bin/bash
>lynx -dump http://www/stocks/a.htm > out.file
>lynx -dump http://www/stocks/b.htm >> out.file
>lynx -dump http://www/stocks/c.htm >> out.file

What part of "without storing in any temporary file" is causing you
trouble?

Re: pipe multiple pages in lynx

am 08.01.2006 20:34:01 von JP Vossen

> In article ,
>>sheller wrote:
>>
>>>I wish to add the contents of the follwing two or many
>>>pages into one (say through piping) at one
>>>stroke, without storing in any temporary file.
>>>Any idea please? Thanks.

How about wget? From the man page:
wget -O - http://jagor.srce.hr/ http://www.srce.hr/

-O file
--output-document=file
The documents will not be written to the appropriate files, but all
will be concatenated together and written to file. If file already
exists, it will be overwritten. If the file is -, the documents
will be written to standard output. Including this option automat-
ically sets the number of tries to 1.


>> matt_left_coast wrote:
>>#!/bin/bash
>>lynx -dump http://www/stocks/a.htm > out.file
>>lynx -dump http://www/stocks/b.htm >> out.file
>>lynx -dump http://www/stocks/c.htm >> out.file
>
> Kenny McCormack wrote:
> What part of "without storing in any temporary file" is causing you
> trouble?

ROTFL: get out of my brain. :-)

Re: pipe multiple pages in lynx

am 08.01.2006 20:59:40 von xicheng

Hi, sheller:

Under bash, you can group the STDOUT of your commands in the following
way:

cat <(lynx -dump http://www/stocks/a.htm) <(lynx -dump
http://www/stocks/b.htm)

HTH,
Xicheng

sheller wrote:
> I wish to add the contents of the follwing two or many
> pages into one (say through piping) at one
> stroke, without storing in any temporary file.
> Any idea please? Thanks.
>
> #!/bin/bash
> lynx -dump http://www/stocks/a.htm
> lynx -dump http://www/stocks/b.htm
>
>
> -arasu

Re: pipe multiple pages in lynx

am 08.01.2006 21:44:31 von matt_left_coast

Kenny McCormack wrote:

> In article ,
> matt_left_coast wrote:
>>sheller wrote:
>>
>>> I wish to add the contents of the follwing two or many
>>> pages into one (say through piping) at one
>>> stroke, without storing in any temporary file.
>>> Any idea please? Thanks.
> ...
>>#!/bin/bash
>>lynx -dump http://www/stocks/a.htm > out.file
>>lynx -dump http://www/stocks/b.htm >> out.file
>>lynx -dump http://www/stocks/c.htm >> out.file
>
> What part of "without storing in any temporary file" is causing you
> trouble?

Dude, If he wants to send the output to the screen, his script would do
exactly what he wanted, so he is obviously NOT asking to send it to the
screen. Try it.

Then, ever think there might be a difference between a temp file and an
output file? You know `cat tempfile1 tempfile2 > output file; rm -rf
tempfile*`????? The "temp" file is only used to create the concatenated
final output file which is not actually "temporary". Gee, guess that is
over your head.

Thus, it is logical that he is asking to send the output to a file, else why
bother asking the question? Since his script would indeed work if all he
wanted was outputting to the screen, I am assuming he is trying to avoid
something like:

lynx -dump http://www/stocks/a.htm > tmpfile1.file
lynx -dump http://www/stocks/b.htm > tmpfile2.file
lynx -dump http://www/stocks/c.htm > tmpfile3.file

cat tempfile* > archivefile.save

rm -rf tempfile*

Where temp files are actual TEMPORARY and the output file is NOT considered
"temporary" but rather as a final data file.

Gezzz.

--

Re: pipe multiple pages in lynx

am 08.01.2006 21:45:34 von Sven Mascheck

wrote:

> I wish to add the contents of the follwing two or many
> pages into one (say through piping) at one stroke,
> without storing in any temporary file.
>
> #!/bin/bash
> lynx -dump http://www/stocks/a.htm
> lynx -dump http://www/stocks/b.htm

What do you actually want (instead)?
The above does what you ask for.

$ ./script > dump

Re: pipe multiple pages in lynx

am 08.01.2006 21:47:55 von matt_left_coast

JP Vossen wrote:

>> In article ,
>>>sheller wrote:
>>>
>>>>I wish to add the contents of the follwing two or many
>>>>pages into one (say through piping) at one
>>>>stroke, without storing in any temporary file.
>>>>Any idea please? Thanks.
>
> How about wget? From the man page:
> wget -O - http://jagor.srce.hr/ http://www.srce.hr/
>
> -O file
> --output-document=file
> The documents will not be written to the appropriate files, but all
> will be concatenated together and written to file. If file already
> exists, it will be overwritten. If the file is -, the documents
> will be written to standard output. Including this option automat-
> ically sets the number of tries to 1.
>

Writing to the file would accomplish exactly the same as what I suggested
and writing to standard output would accomplish exactly the same as his
original script.

>
> >> matt_left_coast wrote:
> >>#!/bin/bash
> >>lynx -dump http://www/stocks/a.htm > out.file
> >>lynx -dump http://www/stocks/b.htm >> out.file
> >>lynx -dump http://www/stocks/c.htm >> out.file
> >
> > Kenny McCormack wrote:
>> What part of "without storing in any temporary file" is causing you
>> trouble?
>
> ROTFL: get out of my brain. :-)

What brain?

--

Re: pipe multiple pages in lynx

am 08.01.2006 21:52:06 von cfajohnson

On 2006-01-08, matt_left_coast wrote:
> sheller wrote:
>
>> I wish to add the contents of the follwing two or many
>> pages into one (say through piping) at one
>> stroke, without storing in any temporary file.
>> Any idea please? Thanks.
>>
>> #!/bin/bash
>> lynx -dump http://www/stocks/a.htm
>> lynx -dump http://www/stocks/b.htm
>>
>>
>> -arasu
> #!/bin/bash
> lynx -dump http://www/stocks/a.htm > out.file
> lynx -dump http://www/stocks/b.htm >> out.file
> lynx -dump http://www/stocks/c.htm >> out.file
>
> A single '>' creates a new file if none exists or overwrites an existing
> file. The ">>" creates a new file if none exists or *appends* an existing
> file. So, the first line would clear out any file from when the script was
> run before and write only a.htm the other lines append to the existing
> file.

Tidier is:

{
lynx -dump http://www/stocks/a.htm
lynx -dump http://www/stocks/b.htm
lynx -dump http://www/stocks/c.htm
} > out.file


--
Chris F.A. Johnson, author |
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence

Re: pipe multiple pages in lynx

am 08.01.2006 21:55:12 von Sven Mascheck

Sven Mascheck wrote:
> wrote:
>
> > without storing in any temporary file.
> >
> > #!/bin/bash
> > lynx -dump http://www/stocks/a.htm
> > lynx -dump http://www/stocks/b.htm

> $ ./script > dump

However, if you want to avoid the script itself:

$ (lynx -dump url1; lynx -dump url2 ) > dump
$ for i in url1 url2 url3 url4 ; do lynx -dump "$i"; done > dump

But perhaps you want to use "wget" to get a collection of pages below
a certain base URL, like your example suggests.

Re: pipe multiple pages in lynx

am 08.01.2006 22:16:55 von matt_left_coast

Chris F.A. Johnson wrote:

> On 2006-01-08, matt_left_coast wrote:
>> sheller wrote:
>>
>>> I wish to add the contents of the follwing two or many
>>> pages into one (say through piping) at one
>>> stroke, without storing in any temporary file.
>>> Any idea please? Thanks.
>>>
>>> #!/bin/bash
>>> lynx -dump http://www/stocks/a.htm
>>> lynx -dump http://www/stocks/b.htm
>>>
>>>
>>> -arasu
>> #!/bin/bash
>> lynx -dump http://www/stocks/a.htm > out.file
>> lynx -dump http://www/stocks/b.htm >> out.file
>> lynx -dump http://www/stocks/c.htm >> out.file
>>
>> A single '>' creates a new file if none exists or overwrites an existing
>> file. The ">>" creates a new file if none exists or *appends* an existing
>> file. So, the first line would clear out any file from when the script
>> was run before and write only a.htm the other lines append to the
>> existing file.
>
> Tidier is:
>
> {
> lynx -dump http://www/stocks/a.htm
> lynx -dump http://www/stocks/b.htm
> lynx -dump http://www/stocks/c.htm
> } > out.file
>
>

Yes, unless you want to echo status between each download, ie:

lynx -dump http://www/stocks/a.htm > out.file

echo "a.htm compleat"

lynx -dump http://www/stocks/b.htm >> out.file

echo "b.htm compleat"

lynx -dump http://www/stocks/c.htm >> out.file

echo "c.htm compleat"

If I were doing this type of script (where there *could* be "many" "...two
or many pages...") I would test for success and echo "a.htm compleat" or
"a.htm failed" to the screen and the lynx error messages to
either /dev/null/ or to a file to check later.

Even if I did not, at first, add the "echo" statements, I would still use my
method so they could be added easier than with your "clean" method.

That is my *preference* in scripting.
--

Re: pipe multiple pages in lynx

am 08.01.2006 22:36:57 von cfajohnson

On 2006-01-08, matt_left_coast wrote:
> Chris F.A. Johnson wrote:
>
>> Tidier is:
>>
>> {
>> lynx -dump http://www/stocks/a.htm
>> lynx -dump http://www/stocks/b.htm
>> lynx -dump http://www/stocks/c.htm
>> } > out.file
>>
> Yes, unless you want to echo status between each download, ie:
>
> lynx -dump http://www/stocks/a.htm > out.file
>
> echo "a.htm compleat"
>
> lynx -dump http://www/stocks/b.htm >> out.file
>
> echo "b.htm compleat"
>
> lynx -dump http://www/stocks/c.htm >> out.file
>
> echo "c.htm compleat"

There's still no need to redirect every call to lynx:

{
lynx -dump http://www/stocks/a.htm && echo "a.htm complete" >&2
lynx -dump http://www/stocks/b.htm && echo "a.htm complete" >&2
lynx -dump http://www/stocks/c.htm && echo "a.htm complete" >&2
} > out.file

> If I were doing this type of script (where there *could* be "many" "...two
> or many pages...") I would test for success and echo "a.htm compleat" or
> "a.htm failed" to the screen and the lynx error messages to
> either /dev/null/ or to a file to check later.

for l in a b c d e f g h i
do
w=http://www/stocks/$l.htm
lynx -dump "$w" && printf "%s complete\n" >&2 ||
printf "%s failed\n" "$w" >&2
done > out.file

> Even if I did not, at first, add the "echo" statements, I would still use my
> method so they could be added easier than with your "clean" method.

It's just as easy to do it my way.

> That is my *preference* in scripting.

And I was showing mine.

--
Chris F.A. Johnson, author |
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence

Re: pipe multiple pages in lynx

am 08.01.2006 22:38:15 von matt_left_coast

Chris F.A. Johnson wrote:

> On 2006-01-08, matt_left_coast wrote:
>> Chris F.A. Johnson wrote:
>>
>>> Tidier is:
>>>
>>> {
>>> lynx -dump http://www/stocks/a.htm
>>> lynx -dump http://www/stocks/b.htm
>>> lynx -dump http://www/stocks/c.htm
>>> } > out.file
>>>
>> Yes, unless you want to echo status between each download, ie:
>>
>> lynx -dump http://www/stocks/a.htm > out.file
>>
>> echo "a.htm compleat"
>>
>> lynx -dump http://www/stocks/b.htm >> out.file
>>
>> echo "b.htm compleat"
>>
>> lynx -dump http://www/stocks/c.htm >> out.file
>>
>> echo "c.htm compleat"
>
> There's still no need to redirect every call to lynx:
>
> {
> lynx -dump http://www/stocks/a.htm && echo "a.htm complete" >&2
> lynx -dump http://www/stocks/b.htm && echo "a.htm complete" >&2
> lynx -dump http://www/stocks/c.htm && echo "a.htm complete" >&2
> } > out.file
>

What a pain.

>> If I were doing this type of script (where there *could* be "many"
>> "...two or many pages...") I would test for success and echo "a.htm
>> compleat" or "a.htm failed" to the screen and the lynx error messages to
>> either /dev/null/ or to a file to check later.
>
> for l in a b c d e f g h i
> do
> w=http://www/stocks/$l.htm
> lynx -dump "$w" && printf "%s complete\n" >&2 ||
> printf "%s failed\n" "$w" >&2
> done > out.file
>
>> Even if I did not, at first, add the "echo" statements, I would still use
>> my method so they could be added easier than with your "clean" method.
>
> It's just as easy to do it my way.

Nope.

>
>> That is my *preference* in scripting.
>
> And I was showing mine.

An unsalable solution. the more you have to add as far as tests and outputs
the more unmanageable each line becomes.

>

--

Re: pipe multiple pages in lynx

am 08.01.2006 22:40:42 von matt_left_coast

Chris F.A. Johnson wrote:

> It's just as easy to do it my way.
>

Nope, it requires more keystrokes. You are just wrong. And as I said
earlier, the idea of doing it all on one line is ultimately not as
scalable.

--

Re: pipe multiple pages in lynx

am 08.01.2006 22:46:44 von matt_left_coast

Chris F.A. Johnson wrote:

> for l in a b c d e f g h i
> do
> w=http://www/stocks/$l.htm
> lynx -dump "$w" && printf "%s complete\n" >&2 ||
> printf "%s failed\n" "$w" >&2
> done > out.file

Now where did the option as to where to dump the lynx error go? Gee, you do
like to ignore what is inconvenient don't you?


"to the screen and the lynx error messages to either /dev/null/ or to a file
to check later"

But I see you are quick to abandon your method as soon as scalability is
involved.

--

Re: pipe multiple pages in lynx

am 08.01.2006 23:01:09 von cfajohnson

On 2006-01-08, matt_left_coast wrote:
> Chris F.A. Johnson wrote:
>
>> for l in a b c d e f g h i
>> do
>> w=http://www/stocks/$l.htm
>> lynx -dump "$w" && printf "%s complete\n" >&2 ||
>> printf "%s failed\n" "$w" >&2
>> done > out.file
>
> Now where did the option as to where to dump the lynx error go? Gee, you do
> like to ignore what is inconvenient don't you?

In exactly the same place as in the other examples. It wasn't in
any of those, but can be added to any of them.

> Gee, you do like to ignore what is inconvenient don't you?

Nothing was ignored.

> "to the screen and the lynx error messages to either /dev/null/ or to a file
> to check later"

If you want it, do it. It's the same in all the examples, even
yours.

> But I see you are quick to abandon your method as soon as scalability is
> involved.

The first method was appropriate to a small number of files; since
the possibility of larger numbers was raised, of course I adjusted
the code.


--
Chris F.A. Johnson, author |
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence

Re: pipe multiple pages in lynx

am 09.01.2006 00:59:45 von Bill Marcum

On Sun, 08 Jan 2006 13:38:15 -0800, matt_left_coast
wrote:
>>
>> There's still no need to redirect every call to lynx:
>>
>> {
>> lynx -dump http://www/stocks/a.htm && echo "a.htm complete" >&2
>> lynx -dump http://www/stocks/b.htm && echo "a.htm complete" >&2
>> lynx -dump http://www/stocks/c.htm && echo "a.htm complete" >&2
>> } > out.file
>>
>
> What a pain.
>
How about this:
dumpurls (){
until [ $# -eq 0 ]; do
lynx -dump "$1" && echo "$1 complete" >&2 || echo "$1 failed" >&2
shift
done
}

Or you could use a "while read" loop...


--
Catharsis is something I associate with pornography and crossword puzzles.
-- Howard Chaykin

Re: pipe multiple pages in lynx

am 09.01.2006 01:01:26 von Bill Marcum

On Sun, 08 Jan 2006 13:46:44 -0800, matt_left_coast
wrote:
> Chris F.A. Johnson wrote:
>
>> for l in a b c d e f g h i
>> do
>> w=http://www/stocks/$l.htm
>> lynx -dump "$w" && printf "%s complete\n" >&2 ||
>> printf "%s failed\n" "$w" >&2
>> done > out.file
>
> Now where did the option as to where to dump the lynx error go? Gee, you do
> like to ignore what is inconvenient don't you?
>
scriptname 2>file


--
Have you reconsidered a computer career?

Re: pipe multiple pages in lynx

am 09.01.2006 04:12:50 von matt_left_coast

Chris F.A. Johnson wrote:

> On 2006-01-08, matt_left_coast wrote:
>> Chris F.A. Johnson wrote:
>>
>>> for l in a b c d e f g h i
>>> do
>>> w=http://www/stocks/$l.htm
>>> lynx -dump "$w" && printf "%s complete\n" >&2 ||
>>> printf "%s failed\n" "$w" >&2
>>> done > out.file
>>
>> Now where did the option as to where to dump the lynx error go? Gee, you
>> do like to ignore what is inconvenient don't you?
>
> In exactly the same place as in the other examples. It wasn't in
> any of those, but can be added to any of them.
>
>> Gee, you do like to ignore what is inconvenient don't you?
>
> Nothing was ignored.

Bullshit. You simply can't face the fact that your script would become a
redirection nightmare if you add a requirement to redirect an error

>
>> "to the screen and the lynx error messages to either /dev/null/ or to a
>> file to check later"
>
> If you want it, do it. It's the same in all the examples, even
> yours.

Why the fuck should I fix YOUR shitty script? Evidently your "cleaner"
script isn't all that FLEXIBLE.

>
>> But I see you are quick to abandon your method as soon as scalability is
>> involved.
>
> The first method was appropriate to a small number of files; since
> the possibility of larger numbers was raised, of course I adjusted
> the code.
>
>

But still have a redirection NIGHTMARE! Your code is UNMANAGEABLE! It can't
even handle the addition of sending custom comments to standard out AND
sending error messages to a separate file!

--

Re: pipe multiple pages in lynx

am 09.01.2006 04:20:39 von matt_left_coast

Bill Marcum wrote:

> On Sun, 08 Jan 2006 13:38:15 -0800, matt_left_coast
> wrote:
>>>
>>> There's still no need to redirect every call to lynx:
>>>
>>> {
>>> lynx -dump http://www/stocks/a.htm && echo "a.htm complete" >&2
>>> lynx -dump http://www/stocks/b.htm && echo "a.htm complete" >&2
>>> lynx -dump http://www/stocks/c.htm && echo "a.htm complete" >&2
>>> } > out.file
>>>
>>
>> What a pain.
>>
> How about this:
> dumpurls (){
> until [ $# -eq 0 ]; do
> lynx -dump "$1" && echo "$1 complete" >&2 || echo "$1 failed" >&2
> shift
> done
> }
>
> Or you could use a "while read" loop...
>
>

Do you guys even TRY your scrips? All the default error messages from Lynx
are echoed. SLOPPY very sloppy.

$ ./test

Looking up google.comsdfasdfasdfasdfa
Unable to locate remote host google.comsdfasdfasdfasdfa.
Alert!: Unable to connect to remote host.

lynx: Can't access startfile http://google.comsdfasdfasdfasdfa/
failed


Bwahahahahahahah.

Re: pipe multiple pages in lynx

am 09.01.2006 04:29:33 von matt_left_coast

Chris F.A. Johnson wrote:

> On 2006-01-08, matt_left_coast wrote:
>> Chris F.A. Johnson wrote:
>>
>>> Tidier is:
>>>
>>> {
>>> lynx -dump http://www/stocks/a.htm
>>> lynx -dump http://www/stocks/b.htm
>>> lynx -dump http://www/stocks/c.htm
>>> } > out.file
>>>
>> Yes, unless you want to echo status between each download, ie:
>>
>> lynx -dump http://www/stocks/a.htm > out.file
>>
>> echo "a.htm compleat"
>>
>> lynx -dump http://www/stocks/b.htm >> out.file
>>
>> echo "b.htm compleat"
>>
>> lynx -dump http://www/stocks/c.htm >> out.file
>>
>> echo "c.htm compleat"
>
> There's still no need to redirect every call to lynx:
>
> {
> lynx -dump http://www/stocks/a.htm && echo "a.htm complete" >&2
> lynx -dump http://www/stocks/b.htm && echo "a.htm complete" >&2
> lynx -dump http://www/stocks/c.htm && echo "a.htm complete" >&2
> } > out.file
>
>> If I were doing this type of script (where there *could* be "many"
>> "...two or many pages...") I would test for success and echo "a.htm
>> compleat" or "a.htm failed" to the screen and the lynx error messages to
>> either /dev/null/ or to a file to check later.
>
> for l in a b c d e f g h i
> do
> w=http://www/stocks/$l.htm
> lynx -dump "$w" && printf "%s complete\n" >&2 ||
> printf "%s failed\n" "$w" >&2
> done > out.file

Damn, sending both the message you want and the default error messages to
the screen, sloppy, very sloppy. Do you even TRY the scripts you write?



--

Re: pipe multiple pages in lynx

am 09.01.2006 08:14:48 von sheller

>I wish to add the contents of the follwing two or many
>pages into one (say through piping) at one
>stroke, without storing in any temporary file.
>Any idea please? Thanks.
>
>#!/bin/bash
>lynx -dump
>lynx -dump
>
>
>-arasu
>

Dear all experts,

I am the orginal questioner!

I read all your wonderful suggestions. I picked up what is appealing to me for
my requirment. I will certainly make use of all other suggestions that are very
useful.

What I really wanted was, to pick up the "strings" from different
web sites without actually storing in different files, and without
displaying all the pages on the screen. This works fine.
It just displays only the strings I wanted from all these webs.
(Ofcourse if I want i can store all in one file)

{
lynx -dump http://www.stocks/nse/i.htm
lynx -dump http://www.stocks/nse/l.htm
lynx -dump http://www.stocks/nse/m.htm
lynx -dump http://www.stocks/nse/r.htm
lynx -dump http://www.stocks/nse/s.htm
lynx -dump http://www./stocks/nse/t.htm
lynx -dump http://www./stocks/bse/l.htm
lynx -dump http://www./stocks/bse/s.htm
lynx -dump http://www./stocks/bse/g.htm
} | grep -E 'string1|string2|string3'

Sorry, If I have confused others, but all are good stuffs.

Thanks.

-arasu

Re: pipe multiple pages in lynx

am 09.01.2006 08:31:16 von matt_left_coast

sheller wrote:

> {
> lynx -dump http://www.stocks/nse/i.htm
> lynx -dump http://www.stocks/nse/l.htm
> lynx -dump http://www.stocks/nse/m.htm
> lynx -dump http://www.stocks/nse/r.htm
> lynx -dump http://www.stocks/nse/s.htm
> lynx -dump http://www./stocks/nse/t.htm
> lynx -dump http://www./stocks/bse/l.htm
> lynx -dump http://www./stocks/bse/s.htm
> lynx -dump http://www./stocks/bse/g.htm
> } | grep -E 'string1|string2|string3'

One thing to consider is that this might make it difficult to tell where the
result came from, did it come from l.htm or g.htm, if that is important. It
may be better to do them individually. Also, if you don't redirect your
error messages, you could be returning unexpected results.

--

Re: pipe multiple pages in lynx

am 09.01.2006 13:49:05 von Sven Mascheck

matt_left_coast wrote:
> Chris F.A. Johnson wrote:
>> matt_left_coast wrote:
>>> Chris F.A. Johnson wrote:

>>>> lynx -dump [...]
>>>> [ STDOUT and STDERR left unchanged, additional diagnostics to STDERR ]

>>> Now where did the option as to where to dump the lynx error go?

>> If you want it, do it.

> Why the fuck should I fix YOUR shitty script?

Obvisouly you're completely missing the point of sending lynx errors
and additional diagnostics to STDERR without redirection at first.
Thus, the user of the script then can redirect STDERR where _he_
wants to have it.

$ script >dumps_only 2>errors_and_diagnostics_only


matt_left_coast wrote:
> Bill Marcum wrote:
>>
>> dumpurls (){

> Do you guys even TRY your scrips?
> All the default error messages from Lynx are echoed.
>
> Bwahahahahahahah.

The same applies to this.


Except that it's not clear yet, whom you wanted to
offend even more, Kid, because you haven't understood
the game in "this sandbox" yet (thread, that is) ;-)

Re: pipe multiple pages in lynx

am 09.01.2006 15:54:25 von matt_left_coast

Sven Mascheck wrote:

> matt_left_coast wrote:
>> Chris F.A. Johnson wrote:
>>> matt_left_coast wrote:
>>>> Chris F.A. Johnson wrote:
>
>>>>> lynx -dump [...]
>>>>> [ STDOUT and STDERR left unchanged, additional diagnostics to STDERR
>>>>> [ ]
>
>>>> Now where did the option as to where to dump the lynx error go?
>
>>> If you want it, do it.
>
>> Why the fuck should I fix YOUR shitty script?
>
> Obvisouly you're completely missing the point of sending lynx errors
> and additional diagnostics to STDERR without redirection at first.
> Thus, the user of the script then can redirect STDERR where _he_
> wants to have it.
>
> $ script >dumps_only 2>errors_and_diagnostics_only

That's not how the script was written.

>
>
> matt_left_coast wrote:
>> Bill Marcum wrote:
>>>
>>> dumpurls (){
>
>> Do you guys even TRY your scrips?
>> All the default error messages from Lynx are echoed.
>>
>> Bwahahahahahahah.
>
> The same applies to this.

BS. You rewrote the script rather than tried to run it.

>
>
> Except that it's not clear yet, whom you wanted to
> offend even more, Kid, because you haven't understood
> the game in "this sandbox" yet (thread, that is) ;-)

To stupid to figure it out, eh?



--

Re: pipe multiple pages in lynx

am 09.01.2006 16:00:55 von matt_left_coast

Sven Mascheck wrote:

> Obvisouly you're completely missing the point of sending lynx errors
> and additional diagnostics to STDERR without redirection at first.
> Thus, the user of the script then can redirect STDERR where he
> wants to have it.
>
> $ script >dumps_only 2>errors_and_diagnostics_only
>
>

Run the script as Chris wrote it and you will find that what you wrote
(which is DIFFERENT than what chris wrote and I objected to) is NOT what
happens.

--

Re: pipe multiple pages in lynx

am 09.01.2006 16:24:41 von Sven Mascheck

matt_left_coast wrote:

> That's not how the script was written.

Formerly, i it seemed to me, you dislike control of STDERR.
Meanwhile it seems, you dislike the hardcoded redirection of STDOUT.

> BS. You rewrote the script rather than tried to run it.

Neither, nor - i read the scripts to get their _point_.
You in turn seem to like getting personal about nitpicking.

Never forget:

Don't expect more from Usenet than pointers for helping yourself.
Even the original poster got the point (so what's your very point?)

Re: pipe multiple pages in lynx

am 09.01.2006 23:14:39 von matt_left_coast

Sven Mascheck wrote:

> matt_left_coast wrote:
>
>> That's not how the script was written.
>
> Formerly, i it seemed to me, you dislike control of STDERR.
> Meanwhile it seems, you dislike the hardcoded redirection of STDOUT.

Where have I said ANYTHING about liking or disliking
control of STDERR or hardcoded redirection of STDOUT??? I dislike how Chris
did it because it is NOT flexable.

Learn to read.

Re: pipe multiple pages in lynx

am 09.01.2006 23:18:18 von matt_left_coast

Sven Mascheck wrote:

> nitpicking

Pot -> Kettle -> black. Only in YOUR case, you don't actually HAVE a point.

--

Re: pipe multiple pages in lynx

am 09.01.2006 23:25:15 von matt_left_coast

Bill Marcum wrote:

> On Sun, 08 Jan 2006 13:46:44 -0800, matt_left_coast
> wrote:
>> Chris F.A. Johnson wrote:
>>
>>> for l in a b c d e f g h i
>>> do
>>> w=http://www/stocks/$l.htm
>>> lynx -dump "$w" && printf "%s complete\n" >&2 ||
>>> printf "%s failed\n" "$w" >&2
>>> done > out.file
>>
>> Now where did the option as to where to dump the lynx error go? Gee, you
>> do like to ignore what is inconvenient don't you?
>>
> scriptname 2>file
>
>

Read the script Chris wrote. You would be sending more than just the error
messages to the file. He redirected the printf commands to standard error
so it would bypass his redirect to out.file and the messages would appear
on the screen. Your method would defeat his sloppy attempt at sending
status to the screen. It is simply sloppy code, period.

--

Re: pipe multiple pages in lynx

am 09.01.2006 23:26:59 von matt_left_coast

matt_left_coast wrote:

>> $ script >dumps_only 2>errors_and_diagnostics_only
>>
>>
>
> Run the script as Chris wrote it and you will find that what you wrote
> (which is DIFFERENT than what chris wrote and I objected to) is NOT what
> happens.
>

Let's see, people that try to make a point and are shown to be WRONG then
attack trying to say I'm getting personal over nitpicking, sounds like SOUR
GRAPES to me!

--

Re: pipe multiple pages in lynx

am 10.01.2006 07:14:56 von Bill Marcum

On Sun, 08 Jan 2006 19:20:39 -0800, matt_left_coast
wrote:
> Bill Marcum wrote:
>
>> On Sun, 08 Jan 2006 13:38:15 -0800, matt_left_coast
>> wrote:
>>>>
>>>> There's still no need to redirect every call to lynx:
>>>>
>>>> {
>>>> lynx -dump http://www/stocks/a.htm && echo "a.htm complete" >&2
>>>> lynx -dump http://www/stocks/b.htm && echo "a.htm complete" >&2
>>>> lynx -dump http://www/stocks/c.htm && echo "a.htm complete" >&2
>>>> } > out.file
>>>>
>>>
>>> What a pain.
>>>
>> How about this:
>> dumpurls (){
>> until [ $# -eq 0 ]; do
>> lynx -dump "$1" && echo "$1 complete" >&2 || echo "$1 failed" >&2
>> shift
>> done
>> }
>>
>> Or you could use a "while read" loop...
>>
>>
>
> Do you guys even TRY your scrips? All the default error messages from Lynx
> are echoed. SLOPPY very sloppy.
>
If you don't want error messages, you can redirect 2>/dev/null.


--
A vivid and creative mind characterizes you.

Re: pipe multiple pages in lynx

am 10.01.2006 08:04:37 von matt_left_coast

Bill Marcum wrote:

> On Sun, 08 Jan 2006 19:20:39 -0800, matt_left_coast
> wrote:
>> Bill Marcum wrote:
>>
>>> On Sun, 08 Jan 2006 13:38:15 -0800, matt_left_coast
>>> wrote:
>>>>>
>>>>> There's still no need to redirect every call to lynx:
>>>>>
>>>>> {
>>>>> lynx -dump http://www/stocks/a.htm && echo "a.htm complete" >&2
>>>>> lynx -dump http://www/stocks/b.htm && echo "a.htm complete" >&2
>>>>> lynx -dump http://www/stocks/c.htm && echo "a.htm complete" >&2
>>>>> } > out.file
>>>>>
>>>>
>>>> What a pain.
>>>>
>>> How about this:
>>> dumpurls (){
>>> until [ $# -eq 0 ]; do
>>> lynx -dump "$1" && echo "$1 complete" >&2 || echo "$1 failed" >&2
>>> shift
>>> done
>>> }
>>>
>>> Or you could use a "while read" loop...
>>>
>>>
>>
>> Do you guys even TRY your scrips? All the default error messages from
>> Lynx are echoed. SLOPPY very sloppy.
>>
> If you don't want error messages, you can redirect 2>/dev/null.
>
>

If you actually READ the way Cris wrote HIS script, that would redirect
status messages that ARE NOT ERROR MESSAGES to /dev/null as well. The
SLOPPY way Chris wrote his script, you can not send a status message for
each download to the screen AND send error messages to /dev/null at the
same time. That is sloppy programming that I am objecting to and even that
seems WELL over your head. Get it yet??? In chris' script, your suggestion
sends LEGITIMATE NON ERROR MESSAGES to /dev/null as well as error messages.
It is OBVIOUS to me that you don't understand redirects enough to
understand WHAT chris' script is doing and are to stupid to know that your
lack of understanding means your should not be commenting on that which you
don't understand.


Do you even have the slightest idea what you are talking about or are you
just reading your notes from a class you took years ago?
--

Re: pipe multiple pages in lynx

am 10.01.2006 08:05:23 von matt_left_coast

Bill Marcum wrote:

> On Sun, 08 Jan 2006 19:20:39 -0800, matt_left_coast
> wrote:
>> Bill Marcum wrote:
>>
>>> On Sun, 08 Jan 2006 13:38:15 -0800, matt_left_coast
>>> wrote:
>>>>>
>>>>> There's still no need to redirect every call to lynx:
>>>>>
>>>>> {
>>>>> lynx -dump http://www/stocks/a.htm && echo "a.htm complete" >&2
>>>>> lynx -dump http://www/stocks/b.htm && echo "a.htm complete" >&2
>>>>> lynx -dump http://www/stocks/c.htm && echo "a.htm complete" >&2
>>>>> } > out.file
>>>>>
>>>>
>>>> What a pain.
>>>>
>>> How about this:
>>> dumpurls (){
>>> until [ $# -eq 0 ]; do
>>> lynx -dump "$1" && echo "$1 complete" >&2 || echo "$1 failed" >&2
>>> shift
>>> done
>>> }
>>>
>>> Or you could use a "while read" loop...
>>>
>>>
>>
>> Do you guys even TRY your scrips? All the default error messages from
>> Lynx are echoed. SLOPPY very sloppy.
>>
> If you don't want error messages, you can redirect 2>/dev/null.
>
>

Bwhahahahhahahahhahahahahahahah.

--

Re: pipe multiple pages in lynx

am 10.01.2006 08:09:13 von matt_left_coast

Bill Marcum wrote:

> If you don't want error messages, you can redirect 2>/dev/null.
>

And the way you wrote YOUR script your - echo "$1 failed" >&2 - would ALSO
be sent to /dev/null. How come you are making suggestions that break the
fix you suggested earlier?

This is what you suggested to FIX chris's fucked up code:

lynx -dump "$1" && echo "$1 complete" >&2 || echo "$1 failed" >&2

Now, when you redirect 2>/dev/null you send your FIX to dev null, how stupid
is that?

--

Re: pipe multiple pages in lynx

am 10.01.2006 08:10:55 von matt_left_coast

Bill Marcum wrote:

> On Sun, 08 Jan 2006 13:38:15 -0800, matt_left_coast
> wrote:
>>>
>>> There's still no need to redirect every call to lynx:
>>>
>>> {
>>> lynx -dump http://www/stocks/a.htm && echo "a.htm complete" >&2
>>> lynx -dump http://www/stocks/b.htm && echo "a.htm complete" >&2
>>> lynx -dump http://www/stocks/c.htm && echo "a.htm complete" >&2
>>> } > out.file
>>>
>>
>> What a pain.
>>
> How about this:
> dumpurls (){
> until [ $# -eq 0 ]; do
> lynx -dump "$1" && echo "$1 complete" >&2 || echo "$1 failed" >&2
> shift
> done
> }
>
> Or you could use a "while read" loop...
>
>


Dude, that would combine the error messages from lynx with the output of the
echo command. Simply STUPID.
--

Re: pipe multiple pages in lynx

am 10.01.2006 08:49:36 von matt_left_coast

Bill Marcum wrote:

> On Sun, 08 Jan 2006 19:20:39 -0800, matt_left_coast
> wrote:
>> Bill Marcum wrote:
>>
>>> On Sun, 08 Jan 2006 13:38:15 -0800, matt_left_coast
>>> wrote:
>>>>>
>>>>> There's still no need to redirect every call to lynx:
>>>>>
>>>>> {
>>>>> lynx -dump http://www/stocks/a.htm && echo "a.htm complete" >&2
>>>>> lynx -dump http://www/stocks/b.htm && echo "a.htm complete" >&2
>>>>> lynx -dump http://www/stocks/c.htm && echo "a.htm complete" >&2
>>>>> } > out.file
>>>>>
>>>>
>>>> What a pain.
>>>>
>>> How about this:
>>> dumpurls (){
>>> until [ $# -eq 0 ]; do
>>> lynx -dump "$1" && echo "$1 complete" >&2 || echo "$1 failed" >&2
>>> shift
>>> done
>>> }
>>>
>>> Or you could use a "while read" loop...
>>>
>>>
>>
>> Do you guys even TRY your scrips? All the default error messages from
>> Lynx are echoed. SLOPPY very sloppy.
>>
> If you don't want error messages, you can redirect 2>/dev/null.
>
>

Or are you going to suggest a nighmare of redirects:

dumpurls (){
until [ $# -eq 0 ]; do
lynx -dump "$1" 2>/dev/null && echo "$1 complete" >&2 || echo "$1 failed">&2
shift
done > file
}
????

bwahahahahhahaha, That's supposed to be the "cleaner" solution????
Bwahahahahhahahahah. Code to much like that and you will have the most
UNMANAGEABLE code EVER! Already someone that has to sit down and try to
figure out what you are trying to do would say "what the fuck was this
idiot thinking?" I said my preference was NOT to use that stile because it
could not be scaled easily, you have proven my point.

But now let's talk about your TEST. Yes it test if the COMMAND downloaded
_A_ page but NOT that it got the RIGHT page! If you download an "Error 404"
page (you know, a page not found error) your stupid test would still act as
if it were a SUCCESS! What a LOUSY test! It's just WRONG. If you are
testing to see if you are SUCCESSFUL it would be nice to know if you got
the DATA you want! I mean REALLY, do you REALLY think that testing if the
COMMAND works is testing that you are successfully getting the results you
want?


No, the problem with the approach that chris suggested is that it if you
need to add LEGITIMATE tests and do some different redirecting or
additional functionality, it does not take much before you have to re-write
the core logic. Although I wrote my initial suggestion to show how ">" and
">>" work, all sorts of things could be ADDED without being forced to
re-write the core logic!




--