[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Replace line in file based on pattern



Folks:

In a script, I'd like to search for a pattern in a file, and replace that line entirely with a new line, once (not globally). I've tried

sed -i s/search/new_line/

but this only replaces the string itself. I want the script to find the line my search term is on, and replace the whole line with my replacement line.

Anyone know how to do this?

Paul


Reply to: