Say I have the following csv file:
id,message,time
123,\"Sorry, This message
has commas and newlines\",2016-03-28T20:26:39
456,\"It makes the problem non
As said here
gawk -v RS='"' 'NR % 2 == 0 { gsub(/\n/, "") } { printf("%s%s", $0, RT) }' file.csv \
| awk -F, '{print $NF}'
To handle specifically those newlines that are in doubly-quoted strings and leave those alone that are outside them, using GNU awk (for RT):
gawk -v RS='"' 'NR % 2 == 0 { gsub(/\n/, "") } { printf("%s%s", $0, RT) }' file
This works by splitting the file along " characters and removing newlines in every other block.
Output
time
2016-03-28T20:26:39
2016-03-28T20:26:41
Then use awk to split the columns and display the last column