I have input which has some fields
- separated by spaces,
- some other are enclosed in quotes and also seperated by spaces
Here is an example input:
active=1 'oldest active'=0s disabled=0 'function call'=0
I would like to replace :
- all spaces outside quotes by
|
and - all inside quotes by
_
Output would be:
active=1|'oldest_active'=0s|disabled=0|'function_call'=0
I tried different solutions with sed
or perl
found on the web but did not managed to do want I want.