< Return to Blog

Stripping sensitive details copied from terminal STDOUT by piping via sed in Mac OS X

Having run into an issue today, I wanted to contribute some error details to an issue on Github, and wanted to strip out details from the output that I'd copied in iTerm.

I was able to pipe the contents of my paste buffer (clipboard) through sed to perform a regexp based search & replace, and pipe the cleaned output into TextMate.

$ pbpaste | sed "s/inertialbox/foo/g" | mate

Here's the output!

ERROR in ./~/css-loader!./~/sass-loader?outputStyle=expanded!./src/styles/Imagebox.sass
Module build failed:
.Imagebox
^
      Invalid top-level expression
      in /Volumes/foo/hack/node/react-webpack-example/src/styles/Imagebox.sass (line 1, column 1)
 @ ./src/styles/Imagebox.sass 4:14-298
INFO [karma]: Karma v0.12.37 server started at http://localhost:8080/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.8 (Mac OS X 0.0.0)]: Connected on socket VvzYKnxwnjInFmolV93m with id 20249201
PhantomJS 1.9.8 (Mac OS X 0.0.0) ERROR
  Error: Cannot find module "!!/Volumes/foo/hack/node/react-webpack-example/node_modules/css-loader/index.js!/Volumes/foo/hack/node/react-webpack-example/node_modules/sass-loader/index.js?outputStyle=expanded!/Volumes/foo/hack/node/react-webpack-example/src/styles/Imagebox.sass"
  at /Volumes/foo/hack/node/react-webpack-example/test/spec/components/Imagebox.js:22690
PhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 0 of 0 ERROR (0.075 secs / 0 secs)
Warning: Task "karma:unit" failed. Use --force to continue.