Discussion:
a question of sed
(too old to reply)
runhao chen
2014-09-15 07:36:13 UTC
Permalink
hi
I got a question when I use sed, please refer to the log:
*******************************************************************beginning
of log
***@roger-T540p-Ubuntu:/home/roger/work/shell# cat emp.txt
100 Jason Smith
200 John Doe
what happened?!
300 Sanjay Gupta
400 Ashok Sharma
500 roger chen

***@roger-T540p-Ubuntu:/home/roger/work/shell# sed -n -i '3d' emp.txt
***@roger-T540p-Ubuntu:/home/roger/work/shell# cat emp.txt
***@roger-T540p-Ubuntu:/home/roger/work/shell#
*******************************************************************end of
log

I just want to delete the third line " what happened?!", and after the
command, all lines were deleted.

did it suppose to be ?

thank you for your time!
--
Best Regards,
Roger Chen
Paolo Bonzini
2014-09-15 14:35:14 UTC
Permalink
Post by runhao chen
*******************************************************************end of
log
I just want to delete the third line " what happened?!", and after the
command, all lines were deleted.
did it suppose to be ?
Yes, you should not have included -n.

Paolo

Loading...