remove first two bytes of a line

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I have a file that has 2 bytes of binary indicator values in every row that has to be stripped off.



I tried sed, awk, cut but none of them work (though they work in vi mode):



sed 's/^.,2//' file.dat
awk 'print substr($0,3)' file
cut -c3- file


Example:



<84>^cColumn1,Column2
x^CColumn1,Column2
v^CColumn1,Column2
<81>^CColumn1,Column2


Desired Output:



Column1,Column2
Column1,Column2
Column1,Column2
Column1,Column2









share|improve this question









New contributor




ranjan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.























    up vote
    1
    down vote

    favorite












    I have a file that has 2 bytes of binary indicator values in every row that has to be stripped off.



    I tried sed, awk, cut but none of them work (though they work in vi mode):



    sed 's/^.,2//' file.dat
    awk 'print substr($0,3)' file
    cut -c3- file


    Example:



    <84>^cColumn1,Column2
    x^CColumn1,Column2
    v^CColumn1,Column2
    <81>^CColumn1,Column2


    Desired Output:



    Column1,Column2
    Column1,Column2
    Column1,Column2
    Column1,Column2









    share|improve this question









    New contributor




    ranjan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have a file that has 2 bytes of binary indicator values in every row that has to be stripped off.



      I tried sed, awk, cut but none of them work (though they work in vi mode):



      sed 's/^.,2//' file.dat
      awk 'print substr($0,3)' file
      cut -c3- file


      Example:



      <84>^cColumn1,Column2
      x^CColumn1,Column2
      v^CColumn1,Column2
      <81>^CColumn1,Column2


      Desired Output:



      Column1,Column2
      Column1,Column2
      Column1,Column2
      Column1,Column2









      share|improve this question









      New contributor




      ranjan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I have a file that has 2 bytes of binary indicator values in every row that has to be stripped off.



      I tried sed, awk, cut but none of them work (though they work in vi mode):



      sed 's/^.,2//' file.dat
      awk 'print substr($0,3)' file
      cut -c3- file


      Example:



      <84>^cColumn1,Column2
      x^CColumn1,Column2
      v^CColumn1,Column2
      <81>^CColumn1,Column2


      Desired Output:



      Column1,Column2
      Column1,Column2
      Column1,Column2
      Column1,Column2






      text-processing






      share|improve this question









      New contributor




      ranjan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      ranjan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 6 mins ago









      sddgob

      16.3k102564




      16.3k102564






      New contributor




      ranjan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 6 hours ago









      ranjan

      62




      62




      New contributor




      ranjan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      ranjan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      ranjan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote













          Using cut:



          cut -b 3- infile


          This will cut the first 2 bytes from each line or print from 3rd byte to end of line.






          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',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );






            ranjan is a new contributor. Be nice, and check out our Code of Conduct.









             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f476392%2fremove-first-two-bytes-of-a-line%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote













            Using cut:



            cut -b 3- infile


            This will cut the first 2 bytes from each line or print from 3rd byte to end of line.






            share|improve this answer
























              up vote
              2
              down vote













              Using cut:



              cut -b 3- infile


              This will cut the first 2 bytes from each line or print from 3rd byte to end of line.






              share|improve this answer






















                up vote
                2
                down vote










                up vote
                2
                down vote









                Using cut:



                cut -b 3- infile


                This will cut the first 2 bytes from each line or print from 3rd byte to end of line.






                share|improve this answer












                Using cut:



                cut -b 3- infile


                This will cut the first 2 bytes from each line or print from 3rd byte to end of line.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 6 hours ago









                sddgob

                16.3k102564




                16.3k102564




















                    ranjan is a new contributor. Be nice, and check out our Code of Conduct.









                     

                    draft saved


                    draft discarded


















                    ranjan is a new contributor. Be nice, and check out our Code of Conduct.












                    ranjan is a new contributor. Be nice, and check out our Code of Conduct.











                    ranjan is a new contributor. Be nice, and check out our Code of Conduct.













                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f476392%2fremove-first-two-bytes-of-a-line%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay