[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
kevin wrote: > is it possible to use sed to find more than two different lines of a > file. > ie I am having to hack out lines like > > $database="blablabla"; > $host="localhost"; > > from many php files > I can, using the expression sed -e '/$host/,/$database/d' more.php > > more.txt as this woks fine. It may not work fine, depending on what you expect it to do :) sed -e '/$host/,/$database/d' will delete all lines from one containing "$host" to one containing "$database". > but sed -e > '/$host/,/$database/,/$user/d' addveg.php > more.txt > fails. Am I on the right lines or not? The "d" command in sed takes at most two parameters, so that's never going to work. What you probably want is something like: sed -e '/$database *=/d' -e '/$host *=/d' -e '/$user *=/d' though if you have ten different strings to delete I'd be more tempted to use egrep I think, so you can chain all the different variables into a single regex. Obviously perl would do the job nicely, too, if it isn't too busy making the dinner and solving the world's financial crisis. James -- The Mailing List for the Devon & Cornwall LUG http://mailman.dclug.org.uk/listinfo/list FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html