I basically want to do this:
cat file | grep '<expression>' | sed 's/<expression>/<replacement>/g'
without having to write the expression twice:
cat file | sed 's/<expression>/<replacement>/g'
Is there a way to tell sed not to print lines that does not match the regular expression in the substitute command?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…