Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> you should definitely check the output before overwriting stuff

That wouldn't really help in the case of redirecting sed to the same file.

    $ echo "a" > test.txt
    $ sed s/a/b/ test.txt
    b
    $ sed s/a/b/ test.txt > test.txt
    $ cat test.txt
    $


Indeed. Use >> in preference to > at all times ;)




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: