I want to collapse 4 lines into 1 line, between { and }.
Using this sed regular expression, it's only collapsing the first line.
Any tips would be warmly welcomed.
Code:
$ egrep -v '({|})' file | sed 'N;s/\n/ /'
"weather": "terrible", "Food": "biscuits",
"Hotel": "Fawlty Towers", "country": "United Kingdom"
"weather": "good", "Food": "porridge",
"Hotel": "La Palma", "country": "Spain"
Target data should be formatted like this
Code:
"weather": "terrible", "Food": "biscuits", "Hotel": "Fawlty Towers", "country": "United Kingdom"
"weather": "good", "Food": "porridge", "Hotel": "La Palma", "country": "Spain"
Original data
Code:
{
"weather": "terrible",
"Food": "biscuits",
"Hotel": "Fawlty Towers",
"country": "United Kingdom"
}
{
"weather": "good",
"Food": "porridge",
"Hotel": "La Palma",
"country": "Spain"
}