Hacker News new | past | comments | ask | show | jobs | submit login

sed is great but it's a stream editor; try moving the last line to the start of the file.



sed '$G;1h;1!H;$!d'


Nice try, but efficiency aside, it breaks.

    $ sed '$G;1h;1!H;$!d' <<<foo | hd
    00000000  66 6f 6f 0a 0a             |foo..|
    00000005
    $




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: