如何使用Sed替换特定字符

时间:2017-09-28 13:48:59

标签: bash sed

如何使用 Sed 替换所有粗体字符? (例如从0200到0300)

整个命令在一行

  

NSun的 0000 -0000Mon的 0200 + 2130Tue的 0200 + 2130Wed的 0200 + 2130Thu的 0200 + 2130Fri的 0200 + 2130Sat的 0000 -0000

这必须是一个通用命令,因为数字可以改变(但总是在同一个地方)。

1 个答案:

答案 0 :(得分:1)

假设您有Bash,并且想要将每个Bash更改为0300。

SyntaxError: Unexpected token import
    at createScript (vm.js:74:10)
    at Object.runInThisContext (vm.js:116:10)
    at Module._compile (module.js:533:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at requireConfig 
    (/var/www/html_dev/reactApp/node_modules/webpack/bin/convert-argv.js:97:18)
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! reactApp@1.0.0 build: `webpack  --colors --display-error-details`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the reactApp@1.0.0 build script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    npm ERR! A complete log of this run can be found in:
    npm ERR!     /home/manish/.npm/_logs/2017-09-28T14_14_06_287Z-debug.log


package.json

{
  "name": "reactApp",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "webpack-dev-server --hot",
    "build": "webpack  --colors --display-error-details"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "babel-cli": "^6.26.0",
    "babel-preset-node6": "^11.0.0",
    "react": "^16.0.0",
    "react-dom": "^16.0.0",
    "watchman": "^0.1.8",
    "webpack": "^3.6.0",
    "webpack-dev-server": "^2.9.1"
  },
  "devDependencies": {
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.2",
    "babel-preset-env": "^1.6.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-latest": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "babel-preset-stage-2": "^6.24.1",
    "babel-register": "^6.26.0"
  }
}

webpack.config.js

import path from 'path';

var config = {
   entry: './main.js',

   output: {
      path: path.join( __dirname, './public/'),
      filename: 'bundle.js',
   },

   devServer: {
      inline: true,
      port: 8000
   },

   module: {
      loaders: [
         {
            test: /\.jsx?$/,
            exclude: /node_modules/,
            loader: 'babel-loader',             
         }
      ]
   }
}

module.exports = config;

问候!