LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   remove new lines (https://www.linuxquestions.org/questions/programming-9/remove-new-lines-4175496735/)

suneelbabu.etl 03-02-2014 08:51 AM

remove new lines
 
hi
Code:

10,"Special Projects,bangaram",0,,0
10,"Statutory/ Internal Audit , MO reporting (incl Excel Spreadsheet uploadation)",        bangaram,0,,0
10,"Complience with SVCCL",        bangaram,        0,,        0
10,        "Release of incentives / commission to all channel partners.
",        bangaram,        0,,        0
10,"Timely processing of sales orders to channel partners",        bangaram,        0,,        0
10,"        Balance sheet Reviwe", bangaram,        0,,        0
10,"        Ensuring Critical Reconciliation on monthly basis. (IN-GL)",        bangaram,        0,,        0
10,        "Timely & accurate closure of Accounts.
",        bangaram,        0,,        0
11,"        Opex Spend on communication activites",        bangaram,        0,,        0
11,"        Opex Spend on communication activites",        bangaram        ,0,,        0

i want to output like
Code:

10,"Special Projects,bangaram",0,,0
10,"Statutory/ Internal Audit , MO reporting (incl Excel Spreadsheet uploadation)",    bangaram,0,,0
10,"Complience with SVCCL",    bangaram,      0,,    0
10,    "Release of incentives / commission to all channel partners.",      bangaram,      0,,    0
10,"Timely processing of sales orders to channel partners",    bangaram,      0,,    0
10,"    Balance sheet Reviwe", bangaram,        0,,    0
10,"    Ensuring Critical Reconciliation on monthly basis. (IN-GL)",    bangaram,      0,,    0
10,    "Timely & accurate closure of Accounts.",      bangaram,      0,,    0
11,"    Opex Spend on communication activites", bangaram,      0,,    0
11,"    Opex Spend on communication activites", bangaram        ,0,,    0


here logic is every row should be 5 comma's if not just concatenate to next line..(it deletes the new lines) that's it.. plz tel me how to write shell script...

John VV 03-02-2014 01:48 PM

What ?
Please explain

and SPELL OUT YOUR WORDS !!!!
"please" IS NOT SPELLED AS "plz" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
this is NOT a telephone and you are NOT !!!!! TEXTING!!!!!!!!!!!!!!
so please REFRAIN from using "text-speak"


as to a shell script
we will NOT do it for you

so please POST what you have done so far and where you are stuck

suneelbabu.etl 03-03-2014 01:45 AM

in my file have 5 columns..
in that middle of that data have new lines ..
just delete new lines and add to previous line..

That's it

John VV 03-03-2014 02:35 AM

please post what you have so far for the script

TB0ne 03-04-2014 09:36 AM

Quote:

Originally Posted by suneelbabu.etl (Post 5127802)
in my file have 5 columns..
in that middle of that data have new lines ..
just delete new lines and add to previous line..

That's it

Ok..so what you're really after is to take any line that starts with a double-quote ("), and join it to the end of the line above it. You've shown no effort of your own, because that question has been asked (and answered), THOUSANDS of times on Google already, and if you tried to look it up, you'd have found it. An example:
Code:

sed '/^X/{N;s/\n/ /;}'


All times are GMT -5. The time now is 09:20 AM.