Removing line breaks from a single cell in a CSV file using shell script

I've been at this seemingly simple issue for at least 8 hours now lol

Not necessarily essential context: I'm using shell script to run bash that imports a csv file which contains SQLs that will be run on Hive server, and writes the result into a certain column.

Everything works fine… EXCEPT, when the SQL statement has a line break.

For example, this works fine:

SELECT column1 FROM table1

But it always cuts off after "SELECT" if it's written like this:

SELECT

column1

FROM

table1

Any suggestions? I've tried multiple awk, sed methods. Googled, chatGPT'ed for hours. Nothing.

I think the issue is from editing excel that gets converted to csv. When I save the excel with line break, on IntelliJ, it gives this linebreak symbol, and for the love of everything that's holy, it doesn't seem to understand.

Any suggestions?

submitted by /u/lightpassion
[link] [comments]

from Software Development – methodologies, techniques, and tools. Covering Agile, RUP, Waterfall + more! https://ift.tt/A3XW2g7

Leave a comment

Design a site like this with WordPress.com
Get started
search previous next tag category expand menu location phone mail time cart zoom edit close