Re: Bash 1-liner needs refining

problems [at] gmail schrieb:
> > AFAIK the following Bash line says,
> > " for each line of file:linksURL DO:
> > elinks -dump <the line of file > & 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 <what is found in the file:Prep to the line and
> > append <what is found in the file:Apend to the line before using it
> > with elinks.
>
> explain further ...
> .
I.e. instead of putting the <prepend> & <append> string directly in the
sed command, put the FileIDs where they can be fetched.

Thanks for feedback,

== Chris Glur.
problems [ Do, 15 November 2007 16:44 ] [ ID #1871027 ]
Linux » comp.unix.shell » Re: Bash 1-liner needs refining

Vorheriges Thema: are there shell commands tha wait on somethign
Nächstes Thema: Is AIX locking files used to redirect stdout+err to in shellscripts and prevents them to be written