I would like to combine multiple lines into one single line in file using bash. I tried almost all options mentioned in: How do I remove newlines from a text file? but no luck and it didn't remove new lines. This file is JSON output from REST API and parsing using bash.
How to combine below lines into 1 line?
File content (actual):
{"key":"HAM-5765","status":"Closed","components":"Web UX","affectedVersions":"ZCS 8.8.x","fixVersions":"Konrad-Zuse-8.8.10","customerFacingInfo":"[https://bug.rectify?id=35231 Bug 35231]
* GetEffectiveRightsRequest failed when a delegated admin could not read zimbraMailHost ([https://bug.rectify?id=108536 Bug 108536])
* Had been unable to remove \"Dynamic Group\" from distribution properties page ([https://bug.rectify?id=108499 Bug 108499])
* After performing a bulk migration, the Delegated Admin user encountered an `HTTP Error 403` when attempting to download the list of provisioned accounts
File content (expected):
{"key":"HAM-5765","status":"Closed","components":"Web UX","affectedVersions":"ZCS 8.8.x","fixVersions":"Konrad-Zuse-8.8.10","customerFacingInfo":"[https://bug.rectify?id=35231 Bug 35231] * GetEffectiveRightsRequest failed when a delegated admin could not read zimbraMailHost ([https://bug.rectify?id=108536 Bug 108536])* Had been unable to remove \"Dynamic Group\" from distribution properties page ([https://bug.rectify?id=108499 Bug 108499])* After performing a bulk migration, the Delegated Admin user encountered an `HTTP Error 403` when attempting to download the list of provisioned accounts
Tried these different commands:
tr -d "\n\r" < yourfile.txt
tr -d '\n' < file.txt
perl -0777 -pe 's/\n+//g' input >output
awk '/[0-9]+/ { a = a $0 ";" } END { print a }' file.txt
perl -p -i -e 's/\R//g;' filename
head -n 1 filename | od -c
perl -pe 's/\s+//g' yourfile.txt