bash

Remove Line from File

You can remove a line (line 74) with sed like this:

sed -i.bak -e '74d' node_modules/something/something.js


The -i.bak param creates a .bak file without the line removed.


And you can even do it safely as a prehook like this:

{
  "name": "some-project",
  "version": "0.0.1",
  "description": "",
  "scripts": {
    "prestart": "[ -f 'node_modules/something/something.js.bak' ] && echo 'line already removed' || (echo 'deleting line from file'; sed -i.bak -e '74d' node_modules/something/something.js)",
    "start": "node index.js"
  }
}