Thread: sed expression question
good day everyone!
sorry ask how in sed "if 'string1' not exist add 'string2' end of file once"?
thank in advance!
use awk can keep counter/flag signify found.
use best tool job.code:awk '/string1/{f=1}end{ if (!f) {print "string2"}}1' file
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk sed expression question
Ubuntu
Comments
Post a Comment