I have been struggling to do this. I need to replace a line in a document with either blank space or the word "DELETED." The lines are different, and I am running a counter to determine the correct line to replace. So far, I have been using:
sed -ie ''$NUMLINE's/^$/DELETED/' Brown_Adam_CIVForms.txt
I would like to replace the 开发者_开发知识库NUMLINE-th line from this document (whatever it may be) and replace it with either blank space or the word "DELETED." Please help!!
Thank you!!!
Just insert .*
between ^
and $
. Like:
sed -ie $NUMLINE's/^.*$/DELETED/' Brown_Adam_CIVForms.txt
you can also use awk
awk -vnum=$NUMLINE 'NR==num{$0="DELETED"}1' file
精彩评论