Re: Bash 1-liner needs refining

Re: Bash 1-liner needs refining

am 15.11.2007 16:44:36 von problems

problems@gmail schrieb:
> > AFAIK the following Bash line says,
> > " for each line of file:linksURL DO:
> > elinks -dump & append to file:accumelinks ",
> > for url in `cat linksURL`; do elinks -dump "$url" >> accumelinks; done
> >
> > Now I want to further reduce the typing in of arguments and say,
> > " for each line of file <>, DO:
> > prepend "http://groups.google.com/" to the line and
> > append "?Ink=sg&hl=en" to the line before using it
> > with elinks.

Martin wrote:
> Learn to sed & quote ...:
>
> for url in `cat linksURL`; do a=$(echo "$url" | sed
> "s/^/http\:\/\/groups.google.com\//" | sed "s/$/\?Ink\=sg\&hl\=en/"); elinks
> -dump "$a" >> accumelinks; done
>
My requirement was wrong: the predend string is:
"http://groups.google.com/group"
So I've tried to modify your sed to:
"...google.com\/group\//"
but this fails.
I'd like a script to just write the set of concatenation of 3 strings tp
a file first, as an off-line test.

> want to reap knowledge out of usenet only in english, hey...?
> Maybe propper use of wget would be more useful.
>
>
> > And then even,
> > " for each line of file <>, DO:
> > prepend > > append > > with elinks.
>
> explain further ...
> .
I.e. instead of putting the & string directly in the
sed command, put the FileIDs where they can be fetched.

Thanks for feedback,

== Chris Glur.