[PLUG] Help with bash script

Paul Heinlein heinlein at attbi.com
Tue Aug 6 13:48:24 UTC 2002


On Tue, 6 Aug 2002, Richard Kurth wrote:

> I need some help with a bash script. I need to read a file and find a
> certain line in that file and then add two lines directly after that
> line.

How about something like this:

#!/bin/bash
while read line
do
  if expr "$line" '.*/cgi-bin/test/' > /dev/null
  then
    echo $line
    echo "new content line 1"
    echo "new content line 2"
  else
    echo $line
  fi
done < httpd.conf


--Paul Heinlein <heinlein at attbi.com>





More information about the PLUG mailing list