Agnus Dei (jackal) wrote,
Agnus Dei
jackal

Dealing with BSD sed on your mac (how to install GNU sed)

Just FYI:   sed that comes with your mac is BSD sed, not GNU sed.  So it doesn't take the same options.

brad-allison-pro:foo brad.allison$ sed -i "55d" "/Users/brad.allison/.ssh/known_hosts"
sed: 1: "/Users/brad.allison/.ss ...": undefined label 'rad.allison/.ssh/known_hosts'


If you are like me and you prefer GNU sed, mac ports provides it and it works just like under linux.

brad-allison-pro:foo brad.allison$ sudo port install gsed
--->  Computing dependencies for gsed
--->  Cleaning gsed
--->  Scanning binaries for linking errors: 100.0%
--->  No broken files found.

brad-allison-pro:foo brad.allison$ gsed -i "55d" "/Users/brad.allison/.ssh/known_hosts"
brad-allison-pro:foo brad.allison$
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 0 comments