[Techtalk] text parsing question

Wim De Smet kromagg at gmail.com
Sun Oct 29 14:04:32 UTC 2006


On 10/26/06, Conor Daly <conor.daly-linuxchix at cod.homelinux.org> wrote:
> This would be my approach, not from any innate superiority of the method,
> more from a lack of sed knowledge.  My bash script would do something
> like:
>
> exec < file
>
> read LINE
>
> echo $LINE | grep '^,$' > /dev/null
>
> if [ $? .eq 0 ]; then
> read LINE2
> read LINE3
> echo "$LINE $LINE2 $LINE3" > outfile
> fi
>
> and something to iterate over the file...

something like this maybe:

exec < file
while read LINE
do
 echo $LINE | grep '^,$' > /dev/null
 if [ $? .eq 0 ]; then
  read LINE2
  read LINE3
  echo "$LINE $LINE2 $LINE3" > outfile
 fi
done


More information about the Techtalk mailing list