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

A sometimes handy addition to the s modifier is g, which replaces all instances of the pattern instead of just the first.

    $ echo "foo foo"
    foo foo
    $ echo !!:s/foo/bar
    echo echo "bar foo"
    echo bar foo

    $ echo "foo foo"
    foo foo
    $ echo !!:gs/foo/bar
    echo echo "bar bar"
    echo bar bar


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

Search: