[Linux-disciples] Grep oddity

Stephen R Laniel steve at laniels.org
Fri Apr 15 12:16:31 EDT 2005


On Fri, Apr 15, 2005 at 10:04:23AM -0400, Adam Rosi-Kessel wrote:
> Yes, it's because stderr is different from stdout.
> Add 2>&1 and your problem will be solved.

Well, I did have that, but ...

> I would take a different approach, though:
> 
> for x in $(grep -o "[0-9]{3}\.jpg" filename.html)
> do
>   if [ ! -e dirname/$x ]
>   then
>      echo File $x does not exist
>   fi
> done

That did the trick. Much more straightforward and clean.
Nice; thanks, Adam.

-- 
Stephen R. Laniel
steve at laniels.org
+(617) 308-5571
http://laniels.org/


More information about the Linux-disciples mailing list