I have line from log file:
field 1234 "text in quotes" 1234 "other text in quotes"
I would like to replace spaces in between quotes, so I could than extract columns using space as delimiter. So the result could be something like
field 1234 "text@in@quotes" 1234 "other@text@in@quotes"
I was not able to find out working regex for sed myself. Thanks a lot for help. Martin
Pipe your log file through this awk command:
If you decide to swap
sed
with more feature richperl
then here is one liner to get what you need:Thanks for all answers.
This is perl one-liner I finally use:
it results in required
.
by using double quote as RS all even records are the ones inside double quotes. replace space in those even records. Since output records separator is newline by default ,change it to double quote.
Ruby(1.9+)