0

I need to replace a specific string inside a CoffeeScript file. The file contains the following values inside:

  version                : '1.3.3.1204.0'
  buildVersion           : '1.3.3.1204.4'

Using shell script, I want to replace the values within quotes, nothing else. Notice there can be X amount of whitespaces between the name and the :

Desired output:

  version                : '2.0.0.0101.0'
  buildVersion           : '2.0.0.0101.1'
dr46ul
  • 3
  • 2
  • Does this answer your question? [How do I use sed to change my configuration files, with flexible keys and values?](https://stackoverflow.com/questions/5955548/how-do-i-use-sed-to-change-my-configuration-files-with-flexible-keys-and-values) – tripleee Dec 12 '19 at 16:20

1 Answers1

0

With :

$ sed "s@'1\.3\.3\.1204\.0'@'2.0.0.0101.0'@;\
       s@'1\.3\.3\.1204\.4'@'2.0.0.0101.1'@" file

 Output

  version                : '2.0.0.0101.0'
  buildVersion           : '2.0.0.0101.1'

 Note

Add -i switch if you want to replace on the fly

Gilles Quénot
  • 173,512
  • 41
  • 224
  • 223