-1

I have a CSV file and I want to remove the all line feeds (LF or \n) which are all coming in between the double quotes alone.

Can you please provide me an Unix script to perform the above task. I have given the input and expected output below.

Input :

No,Status,Date

1,"Success

Error",1/15/2018

2,"Success

Error

NA",2/15/2018

3,"Success

Error",3/15/2018

Expected output:

No,Status,Date

1,"Success Error",1/15/2018

2,"Success Error NA",2/15/2018

3,"Success Error",3/15/2018

1
  • 3
    Welcome to Stack Overflow. This is not a code/SQL/regex writing service, where you post a list of your requirements and language of choice and a code monkey churns out code for you. We're more than happy to help, but we expect you to make an effort to solve the problem yourself first. Once you've done so, you can explain the problem you're having, include the relevant portions of your work, and ask a specific question, and we'll try to help. Good luck. Commented Apr 4, 2018 at 2:46

1 Answer 1

0

I can't write everything for you, as I am not sure about your system as well as which bash version that is running on it. But here are a couple of suggestions that you might want to consider.

https://www.unix.com/shell-programming-and-scripting/31021-removing-line-breaks-shell-variable.html

https://www.unix.com/shell-programming-and-scripting/19484-remove-line-feeds.html

How to remove carriage return from a string in Bash

https://unix.stackexchange.com/questions/57124/remove-newline-from-unix-variable

Remove line breaks in Bourne Shell from variable

https://unix.stackexchange.com/questions/254644/how-do-i-remove-newline-character-at-the-end-of-file

https://serverfault.com/questions/391360/remove-line-break-using-awk

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.