[lug] Bash While Loop Error

SoloCDM deedsmis at aculink.net
Thu Nov 30 00:03:26 MST 2000


I don't know why, but information piped into a while loop is processed
v-e-r-y v-e-r-y slowly.  The following is a simple test bash script
and it took a day to complete one pass through 2.9Gbs of files:

#!/bin/sh
#

find / -xdev -fstype ext2 -type f -printf %h/%f?n | sed 's/\?n/\
/g' | (
while read MLINE
do
  echo "${MLINE}" | sed '/[Gg][Aa][Mm][Ee]/!d'
done)


The find and sed commands on their own produce the information out to
the screen in no time at all.

I'm using kernel 2.2.14 with bash 2.03.

Note: When you reply to this message, please include
      the mailing list and my email address.

*********************************************************************
Signed,
SoloCDM




More information about the LUG mailing list