Scripting / one liner help
hal at burgiss.net
Wed Aug 10 21:46:13 UTC 2011
On Wed, Aug 10, 2011 at 2:42 PM, Patton Echols <p.echols at comcast.net> wrote:
> On 08/10/2011 09:47 AM, Hal Burgiss wrote:
>> See if this gets close to extracting the image names ...
>> grep SRC *html | sed -r 's/SRC="([^"]+)"/\1/ig' | whatever_script.sh
> Thanks Hal,
> my script starts with "for i in *jpg" and then works each file
> individually. So I tried that line without the pipe to whatever_script.sh,
> hoping for a list of files to be output to the terminal. That seemed to
> output the string of tags but without the double quotes around the image
> names. Is that what it should have done?
That was what I was getting at, yes, the list of image filenames.
If you want just file names, you might try:
grep -H SRC *hmtl | sed 's/:.*//' |sort|uniq
or something along those lines. (Completely untested)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ubuntu-users