Convert CSV to tab delimit file in AIX server












1














I have a requirement to transform a csv to a tab delimited file.
But the problem is, I have “,” within name field which I need to maintain.



Source:



Amsterdam, “last name, first name”, Europe


Output:



Amsterdamtlast name, first nametEurope









share|improve this question




















  • 3




    the file contains non-standard quotes
    – RomanPerekhrest
    Jan 16 at 14:17










  • The source data when you open in Microsoft excel it maintains the data integrity as we’ll as my application which processes it. But this has to be processed by an new application which cannot differentiate between comma as delimiter and comma as part of data. Since it can handle tab delimited I am trying to change it to tab format.
    – user2704230
    Jan 16 at 14:23












  • do you python installed? also, what's your awk --version?
    – RomanPerekhrest
    Jan 16 at 14:33












  • @user2704230 yes, tab-separated is a good alternative. See if you can get whoever is exporting the Excel file for you to select TAB as the delimiter when they export. otherwise your best bet would be to use a language with a real CSV parser (CSV has a lot more quirks and oddities and corner cases than most people think, and it's difficult to handle them all with just regular expressions). perl or python, for example.
    – cas
    Jan 16 at 14:49












  • @RomanPerekhrest I am not able to find the version ok awk on my aix server. But I do know that I am using 7.1 version of aix.
    – user2704230
    Jan 16 at 15:12
















1














I have a requirement to transform a csv to a tab delimited file.
But the problem is, I have “,” within name field which I need to maintain.



Source:



Amsterdam, “last name, first name”, Europe


Output:



Amsterdamtlast name, first nametEurope









share|improve this question




















  • 3




    the file contains non-standard quotes
    – RomanPerekhrest
    Jan 16 at 14:17










  • The source data when you open in Microsoft excel it maintains the data integrity as we’ll as my application which processes it. But this has to be processed by an new application which cannot differentiate between comma as delimiter and comma as part of data. Since it can handle tab delimited I am trying to change it to tab format.
    – user2704230
    Jan 16 at 14:23












  • do you python installed? also, what's your awk --version?
    – RomanPerekhrest
    Jan 16 at 14:33












  • @user2704230 yes, tab-separated is a good alternative. See if you can get whoever is exporting the Excel file for you to select TAB as the delimiter when they export. otherwise your best bet would be to use a language with a real CSV parser (CSV has a lot more quirks and oddities and corner cases than most people think, and it's difficult to handle them all with just regular expressions). perl or python, for example.
    – cas
    Jan 16 at 14:49












  • @RomanPerekhrest I am not able to find the version ok awk on my aix server. But I do know that I am using 7.1 version of aix.
    – user2704230
    Jan 16 at 15:12














1












1








1


0





I have a requirement to transform a csv to a tab delimited file.
But the problem is, I have “,” within name field which I need to maintain.



Source:



Amsterdam, “last name, first name”, Europe


Output:



Amsterdamtlast name, first nametEurope









share|improve this question















I have a requirement to transform a csv to a tab delimited file.
But the problem is, I have “,” within name field which I need to maintain.



Source:



Amsterdam, “last name, first name”, Europe


Output:



Amsterdamtlast name, first nametEurope






aix csv






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 16 at 14:14









Jeff Schaller

38.7k1053125




38.7k1053125










asked Jan 16 at 14:10









user2704230

61




61








  • 3




    the file contains non-standard quotes
    – RomanPerekhrest
    Jan 16 at 14:17










  • The source data when you open in Microsoft excel it maintains the data integrity as we’ll as my application which processes it. But this has to be processed by an new application which cannot differentiate between comma as delimiter and comma as part of data. Since it can handle tab delimited I am trying to change it to tab format.
    – user2704230
    Jan 16 at 14:23












  • do you python installed? also, what's your awk --version?
    – RomanPerekhrest
    Jan 16 at 14:33












  • @user2704230 yes, tab-separated is a good alternative. See if you can get whoever is exporting the Excel file for you to select TAB as the delimiter when they export. otherwise your best bet would be to use a language with a real CSV parser (CSV has a lot more quirks and oddities and corner cases than most people think, and it's difficult to handle them all with just regular expressions). perl or python, for example.
    – cas
    Jan 16 at 14:49












  • @RomanPerekhrest I am not able to find the version ok awk on my aix server. But I do know that I am using 7.1 version of aix.
    – user2704230
    Jan 16 at 15:12














  • 3




    the file contains non-standard quotes
    – RomanPerekhrest
    Jan 16 at 14:17










  • The source data when you open in Microsoft excel it maintains the data integrity as we’ll as my application which processes it. But this has to be processed by an new application which cannot differentiate between comma as delimiter and comma as part of data. Since it can handle tab delimited I am trying to change it to tab format.
    – user2704230
    Jan 16 at 14:23












  • do you python installed? also, what's your awk --version?
    – RomanPerekhrest
    Jan 16 at 14:33












  • @user2704230 yes, tab-separated is a good alternative. See if you can get whoever is exporting the Excel file for you to select TAB as the delimiter when they export. otherwise your best bet would be to use a language with a real CSV parser (CSV has a lot more quirks and oddities and corner cases than most people think, and it's difficult to handle them all with just regular expressions). perl or python, for example.
    – cas
    Jan 16 at 14:49












  • @RomanPerekhrest I am not able to find the version ok awk on my aix server. But I do know that I am using 7.1 version of aix.
    – user2704230
    Jan 16 at 15:12








3




3




the file contains non-standard quotes
– RomanPerekhrest
Jan 16 at 14:17




the file contains non-standard quotes
– RomanPerekhrest
Jan 16 at 14:17












The source data when you open in Microsoft excel it maintains the data integrity as we’ll as my application which processes it. But this has to be processed by an new application which cannot differentiate between comma as delimiter and comma as part of data. Since it can handle tab delimited I am trying to change it to tab format.
– user2704230
Jan 16 at 14:23






The source data when you open in Microsoft excel it maintains the data integrity as we’ll as my application which processes it. But this has to be processed by an new application which cannot differentiate between comma as delimiter and comma as part of data. Since it can handle tab delimited I am trying to change it to tab format.
– user2704230
Jan 16 at 14:23














do you python installed? also, what's your awk --version?
– RomanPerekhrest
Jan 16 at 14:33






do you python installed? also, what's your awk --version?
– RomanPerekhrest
Jan 16 at 14:33














@user2704230 yes, tab-separated is a good alternative. See if you can get whoever is exporting the Excel file for you to select TAB as the delimiter when they export. otherwise your best bet would be to use a language with a real CSV parser (CSV has a lot more quirks and oddities and corner cases than most people think, and it's difficult to handle them all with just regular expressions). perl or python, for example.
– cas
Jan 16 at 14:49






@user2704230 yes, tab-separated is a good alternative. See if you can get whoever is exporting the Excel file for you to select TAB as the delimiter when they export. otherwise your best bet would be to use a language with a real CSV parser (CSV has a lot more quirks and oddities and corner cases than most people think, and it's difficult to handle them all with just regular expressions). perl or python, for example.
– cas
Jan 16 at 14:49














@RomanPerekhrest I am not able to find the version ok awk on my aix server. But I do know that I am using 7.1 version of aix.
– user2704230
Jan 16 at 15:12




@RomanPerekhrest I am not able to find the version ok awk on my aix server. But I do know that I am using 7.1 version of aix.
– user2704230
Jan 16 at 15:12










2 Answers
2






active

oldest

votes


















0














Perhaps something like sed -e 's/, "/t/g' -e 's/", /t/g' < intput_file would help. The sed expressions replace , " with t and ", with t.






share|improve this answer





























    0














    Hi with Miller is simple. With




    echo 'Amsterdam,"last name, first name",Europe' |
    mlr --c2t --implicit-csv-header --headerless-csv-output cat



    You have



    Amsterdamtlast name, first nametEurope




    • --c2t is for CSV to TSV;


    • --implicit-csv-header and --headerless-csv-output to set that there is no header both input and output






    share|improve this answer





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "106"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f417521%2fconvert-csv-to-tab-delimit-file-in-aix-server%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      Perhaps something like sed -e 's/, "/t/g' -e 's/", /t/g' < intput_file would help. The sed expressions replace , " with t and ", with t.






      share|improve this answer


























        0














        Perhaps something like sed -e 's/, "/t/g' -e 's/", /t/g' < intput_file would help. The sed expressions replace , " with t and ", with t.






        share|improve this answer
























          0












          0








          0






          Perhaps something like sed -e 's/, "/t/g' -e 's/", /t/g' < intput_file would help. The sed expressions replace , " with t and ", with t.






          share|improve this answer












          Perhaps something like sed -e 's/, "/t/g' -e 's/", /t/g' < intput_file would help. The sed expressions replace , " with t and ", with t.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 24 at 20:44









          james

          464




          464

























              0














              Hi with Miller is simple. With




              echo 'Amsterdam,"last name, first name",Europe' |
              mlr --c2t --implicit-csv-header --headerless-csv-output cat



              You have



              Amsterdamtlast name, first nametEurope




              • --c2t is for CSV to TSV;


              • --implicit-csv-header and --headerless-csv-output to set that there is no header both input and output






              share|improve this answer


























                0














                Hi with Miller is simple. With




                echo 'Amsterdam,"last name, first name",Europe' |
                mlr --c2t --implicit-csv-header --headerless-csv-output cat



                You have



                Amsterdamtlast name, first nametEurope




                • --c2t is for CSV to TSV;


                • --implicit-csv-header and --headerless-csv-output to set that there is no header both input and output






                share|improve this answer
























                  0












                  0








                  0






                  Hi with Miller is simple. With




                  echo 'Amsterdam,"last name, first name",Europe' |
                  mlr --c2t --implicit-csv-header --headerless-csv-output cat



                  You have



                  Amsterdamtlast name, first nametEurope




                  • --c2t is for CSV to TSV;


                  • --implicit-csv-header and --headerless-csv-output to set that there is no header both input and output






                  share|improve this answer












                  Hi with Miller is simple. With




                  echo 'Amsterdam,"last name, first name",Europe' |
                  mlr --c2t --implicit-csv-header --headerless-csv-output cat



                  You have



                  Amsterdamtlast name, first nametEurope




                  • --c2t is for CSV to TSV;


                  • --implicit-csv-header and --headerless-csv-output to set that there is no header both input and output







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 1 hour ago









                  aborruso

                  1215




                  1215






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f417521%2fconvert-csv-to-tab-delimit-file-in-aix-server%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Accessing regular linux commands in Huawei's Dopra Linux

                      Can't connect RFCOMM socket: Host is down

                      Kernel panic - not syncing: Fatal Exception in Interrupt