Replace number in first column with out put of command for every line in file

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











up vote
0
down vote

favorite












Hello all I am dealing with a ham hobby database file, example ;
DMRids.dat (section example) ;



1023001 VE3THW Wayne
1023002 VA3ECM Mathieu
1023003 VE3QC Guy
1023004 VE3LDY Louella
1023005 VE3JFN Jeffrey
1023006 VA3UZ Allan
1023007 VA3BOC Hans
1023008 VE3JMR

1023009 VA3AMO Rolando
1023010 VA3AMO Rolando
1023013 VE3SLD Barry
1023014 VA3DB Diane
1023015 VE3FVD Friedrich
1023016 VE3IAO John
1023017 VA3MSV John
1023018 VA3BTQ Jacqualine
1023019 VA3BTQ Jacqualine
1023020 VE3ZXN Denis
1023021 VE3ZXN Denis
1023022 VE3EM Don
1023023 VA3TDG Douglas
1023024 VA3MRJ David
1023025 VA3ZDX Gregory



For every first column number I want to replace the number with the result of being processed by this script ;
bin.sh
................................



!/bin/bash



cd /tmp
rm bin.txt
echo "obase=2;$1" | bc > bin.txt
sleep 2
value=cat bin.txt
sed -i 's/.*(................)/1/' bin.txt
sleep 2
echo "$((2#cat bin.txt))"
.................................



example manual run for top line ;



root@vk4tux:/tmp# bin.sh 1023001
39961
root@vk4tux:/tmp#



So 1023001 would be replaced by 39961 and so on for each line in file individually treated to bin.sh input output replace. .
Any help much appreciated please?









share







New contributor




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























    up vote
    0
    down vote

    favorite












    Hello all I am dealing with a ham hobby database file, example ;
    DMRids.dat (section example) ;



    1023001 VE3THW Wayne
    1023002 VA3ECM Mathieu
    1023003 VE3QC Guy
    1023004 VE3LDY Louella
    1023005 VE3JFN Jeffrey
    1023006 VA3UZ Allan
    1023007 VA3BOC Hans
    1023008 VE3JMR

    1023009 VA3AMO Rolando
    1023010 VA3AMO Rolando
    1023013 VE3SLD Barry
    1023014 VA3DB Diane
    1023015 VE3FVD Friedrich
    1023016 VE3IAO John
    1023017 VA3MSV John
    1023018 VA3BTQ Jacqualine
    1023019 VA3BTQ Jacqualine
    1023020 VE3ZXN Denis
    1023021 VE3ZXN Denis
    1023022 VE3EM Don
    1023023 VA3TDG Douglas
    1023024 VA3MRJ David
    1023025 VA3ZDX Gregory



    For every first column number I want to replace the number with the result of being processed by this script ;
    bin.sh
    ................................



    !/bin/bash



    cd /tmp
    rm bin.txt
    echo "obase=2;$1" | bc > bin.txt
    sleep 2
    value=cat bin.txt
    sed -i 's/.*(................)/1/' bin.txt
    sleep 2
    echo "$((2#cat bin.txt))"
    .................................



    example manual run for top line ;



    root@vk4tux:/tmp# bin.sh 1023001
    39961
    root@vk4tux:/tmp#



    So 1023001 would be replaced by 39961 and so on for each line in file individually treated to bin.sh input output replace. .
    Any help much appreciated please?









    share







    New contributor




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





















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Hello all I am dealing with a ham hobby database file, example ;
      DMRids.dat (section example) ;



      1023001 VE3THW Wayne
      1023002 VA3ECM Mathieu
      1023003 VE3QC Guy
      1023004 VE3LDY Louella
      1023005 VE3JFN Jeffrey
      1023006 VA3UZ Allan
      1023007 VA3BOC Hans
      1023008 VE3JMR

      1023009 VA3AMO Rolando
      1023010 VA3AMO Rolando
      1023013 VE3SLD Barry
      1023014 VA3DB Diane
      1023015 VE3FVD Friedrich
      1023016 VE3IAO John
      1023017 VA3MSV John
      1023018 VA3BTQ Jacqualine
      1023019 VA3BTQ Jacqualine
      1023020 VE3ZXN Denis
      1023021 VE3ZXN Denis
      1023022 VE3EM Don
      1023023 VA3TDG Douglas
      1023024 VA3MRJ David
      1023025 VA3ZDX Gregory



      For every first column number I want to replace the number with the result of being processed by this script ;
      bin.sh
      ................................



      !/bin/bash



      cd /tmp
      rm bin.txt
      echo "obase=2;$1" | bc > bin.txt
      sleep 2
      value=cat bin.txt
      sed -i 's/.*(................)/1/' bin.txt
      sleep 2
      echo "$((2#cat bin.txt))"
      .................................



      example manual run for top line ;



      root@vk4tux:/tmp# bin.sh 1023001
      39961
      root@vk4tux:/tmp#



      So 1023001 would be replaced by 39961 and so on for each line in file individually treated to bin.sh input output replace. .
      Any help much appreciated please?









      share







      New contributor




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











      Hello all I am dealing with a ham hobby database file, example ;
      DMRids.dat (section example) ;



      1023001 VE3THW Wayne
      1023002 VA3ECM Mathieu
      1023003 VE3QC Guy
      1023004 VE3LDY Louella
      1023005 VE3JFN Jeffrey
      1023006 VA3UZ Allan
      1023007 VA3BOC Hans
      1023008 VE3JMR

      1023009 VA3AMO Rolando
      1023010 VA3AMO Rolando
      1023013 VE3SLD Barry
      1023014 VA3DB Diane
      1023015 VE3FVD Friedrich
      1023016 VE3IAO John
      1023017 VA3MSV John
      1023018 VA3BTQ Jacqualine
      1023019 VA3BTQ Jacqualine
      1023020 VE3ZXN Denis
      1023021 VE3ZXN Denis
      1023022 VE3EM Don
      1023023 VA3TDG Douglas
      1023024 VA3MRJ David
      1023025 VA3ZDX Gregory



      For every first column number I want to replace the number with the result of being processed by this script ;
      bin.sh
      ................................



      !/bin/bash



      cd /tmp
      rm bin.txt
      echo "obase=2;$1" | bc > bin.txt
      sleep 2
      value=cat bin.txt
      sed -i 's/.*(................)/1/' bin.txt
      sleep 2
      echo "$((2#cat bin.txt))"
      .................................



      example manual run for top line ;



      root@vk4tux:/tmp# bin.sh 1023001
      39961
      root@vk4tux:/tmp#



      So 1023001 would be replaced by 39961 and so on for each line in file individually treated to bin.sh input output replace. .
      Any help much appreciated please?







      linux sed scripting





      share







      New contributor




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










      share







      New contributor




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








      share



      share






      New contributor




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









      asked 2 mins ago









      Adrian Fewster

      1




      1




      New contributor




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





      New contributor





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






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

























          active

          oldest

          votes











          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
          );



          );






          Adrian Fewster 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%2f477676%2freplace-number-in-first-column-with-out-put-of-command-for-every-line-in-file%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








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









           

          draft saved


          draft discarded


















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












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











          Adrian Fewster 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%2f477676%2freplace-number-in-first-column-with-out-put-of-command-for-every-line-in-file%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?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?