From Ontani, 9 Months ago, written in Plain Text.
  1. #!/bin/bash
  2.  
  3. input='{ "text" : "<<[{PCMichiel:service_state["Print Spooler"].last(0)}>0]>>" }, "text" : "<<[{PCYente:service_state["Print Service"].last(0)}>0]>>" }'
  4.  
  5. grep -oP '(?<=<<[).*?(?=]>>)' <<< "$input" | while read -r line ; do
  6.  replace=$(sed 's/"/\"/g' <<< $line)
  7.  
  8.  echo $line
  9.  echo $replace
  10.  
  11.  echo ${input//$line/$replace}
  12.  
  13. done
  14.  
  15. #############
  16. Outputs :
  17.  
  18. {PCMichiel:service_state["Print Spooler"].last(0)}>0
  19. {PCMichiel:service_state["Print Spooler"].last(0)}>0
  20. { "text" : "<<[{PCMichiel:service_state["Print Spooler"].last(0)}>0]>>" }, "text" : "<<[{PCYente:service_state["Print Service"].last(0)}>0]>>" }
  21.  
  22. {PCYente:service_state["Print Service"].last(0)}>0
  23. {PCYente:service_state["Print Service"].last(0)}>0
  24. { "text" : "<<[{PCMichiel:service_state["Print Spooler"].last(0)}>0]>>" }, "text" : "<<[{PCYente:service_state["Print Service"].last(0)}>0]>>" }
  25.  

Replies to Untitled rss

Title Name Language When
Re: Untitled Ontani text 9 Months ago.
captcha