how to select part of the row and pasting to form other file?

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











up vote
1
down vote

favorite












I want you help me how to organize my data by cutting in the following way. I have the input data as below.



input.file:



1 2 1 0.6007 0.1 0.3 0.2 0.7 0.7 0 2 0.3073 0.1 0.1 0.2 0.4 0.7 0.5
2 2 1 0.4022 0.1 0.3 0.2 0.7 0.7 0 2 0.5085 0.1 0.1 0.2 0.4 0.7 0.5
3 2 1 0.0029 0.1 0.3 0.2 0.7 0.7 0 2 0.9078 0.1 0.1 0.2 0.4 0.7 0.5
4 2 1 0.0692 0.1 0.3 0.2 0.7 0.7 0 2 0.8805 0.1 0.1 0.2 0.4 0.7 0.5


My desired output file would look like this:



out.file:



1 2 
0.6007 1 0.1 0.3 0.2 0.7 0.7 0
0.3073 2 0.1 0.1 0.2 0.4 0.7 0.5
2 2
0.4022 1 0.1 0.3 0.2 0.7 0.7 0
0.5085 2 0.1 0.1 0.2 0.4 0.7 0.5
3 2
0.0029 1 0.1 0.3 0.2 0.7 0.7 0
0.9078 2 0.1 0.1 0.2 0.4 0.7 0.5
4 2
0.0692 1 0.1 0.3 0.2 0.7 0.7 0
0.8805 2 0.1 0.1 0.2 0.4 0.7 0.5









share|improve this question



























    up vote
    1
    down vote

    favorite












    I want you help me how to organize my data by cutting in the following way. I have the input data as below.



    input.file:



    1 2 1 0.6007 0.1 0.3 0.2 0.7 0.7 0 2 0.3073 0.1 0.1 0.2 0.4 0.7 0.5
    2 2 1 0.4022 0.1 0.3 0.2 0.7 0.7 0 2 0.5085 0.1 0.1 0.2 0.4 0.7 0.5
    3 2 1 0.0029 0.1 0.3 0.2 0.7 0.7 0 2 0.9078 0.1 0.1 0.2 0.4 0.7 0.5
    4 2 1 0.0692 0.1 0.3 0.2 0.7 0.7 0 2 0.8805 0.1 0.1 0.2 0.4 0.7 0.5


    My desired output file would look like this:



    out.file:



    1 2 
    0.6007 1 0.1 0.3 0.2 0.7 0.7 0
    0.3073 2 0.1 0.1 0.2 0.4 0.7 0.5
    2 2
    0.4022 1 0.1 0.3 0.2 0.7 0.7 0
    0.5085 2 0.1 0.1 0.2 0.4 0.7 0.5
    3 2
    0.0029 1 0.1 0.3 0.2 0.7 0.7 0
    0.9078 2 0.1 0.1 0.2 0.4 0.7 0.5
    4 2
    0.0692 1 0.1 0.3 0.2 0.7 0.7 0
    0.8805 2 0.1 0.1 0.2 0.4 0.7 0.5









    share|improve this question

























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I want you help me how to organize my data by cutting in the following way. I have the input data as below.



      input.file:



      1 2 1 0.6007 0.1 0.3 0.2 0.7 0.7 0 2 0.3073 0.1 0.1 0.2 0.4 0.7 0.5
      2 2 1 0.4022 0.1 0.3 0.2 0.7 0.7 0 2 0.5085 0.1 0.1 0.2 0.4 0.7 0.5
      3 2 1 0.0029 0.1 0.3 0.2 0.7 0.7 0 2 0.9078 0.1 0.1 0.2 0.4 0.7 0.5
      4 2 1 0.0692 0.1 0.3 0.2 0.7 0.7 0 2 0.8805 0.1 0.1 0.2 0.4 0.7 0.5


      My desired output file would look like this:



      out.file:



      1 2 
      0.6007 1 0.1 0.3 0.2 0.7 0.7 0
      0.3073 2 0.1 0.1 0.2 0.4 0.7 0.5
      2 2
      0.4022 1 0.1 0.3 0.2 0.7 0.7 0
      0.5085 2 0.1 0.1 0.2 0.4 0.7 0.5
      3 2
      0.0029 1 0.1 0.3 0.2 0.7 0.7 0
      0.9078 2 0.1 0.1 0.2 0.4 0.7 0.5
      4 2
      0.0692 1 0.1 0.3 0.2 0.7 0.7 0
      0.8805 2 0.1 0.1 0.2 0.4 0.7 0.5









      share|improve this question















      I want you help me how to organize my data by cutting in the following way. I have the input data as below.



      input.file:



      1 2 1 0.6007 0.1 0.3 0.2 0.7 0.7 0 2 0.3073 0.1 0.1 0.2 0.4 0.7 0.5
      2 2 1 0.4022 0.1 0.3 0.2 0.7 0.7 0 2 0.5085 0.1 0.1 0.2 0.4 0.7 0.5
      3 2 1 0.0029 0.1 0.3 0.2 0.7 0.7 0 2 0.9078 0.1 0.1 0.2 0.4 0.7 0.5
      4 2 1 0.0692 0.1 0.3 0.2 0.7 0.7 0 2 0.8805 0.1 0.1 0.2 0.4 0.7 0.5


      My desired output file would look like this:



      out.file:



      1 2 
      0.6007 1 0.1 0.3 0.2 0.7 0.7 0
      0.3073 2 0.1 0.1 0.2 0.4 0.7 0.5
      2 2
      0.4022 1 0.1 0.3 0.2 0.7 0.7 0
      0.5085 2 0.1 0.1 0.2 0.4 0.7 0.5
      3 2
      0.0029 1 0.1 0.3 0.2 0.7 0.7 0
      0.9078 2 0.1 0.1 0.2 0.4 0.7 0.5
      4 2
      0.0692 1 0.1 0.3 0.2 0.7 0.7 0
      0.8805 2 0.1 0.1 0.2 0.4 0.7 0.5






      awk copy-paste






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 2 '13 at 22:05









      Smith John

      19.1k76072




      19.1k76072










      asked Sep 2 '13 at 21:58









      AiB

      3472619




      3472619




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote













          We're at it again slm :)



          Similar mechanism in perl, from the command line:



          perl -ane 'print "$F[0] $F[1]n $F[3] $F[2] @F[4..9]n" .
          " $F[11] $F[10] @F[12..17]n"' inputfile


          -n processes each line of inputfile as a loop. -a splits each line around the field separator (which defaults to space) and assigns it to the special array @F and -e passes these to the perl command specified (which simply prints the elements in the order required with spacing and newlines where required).



          To put it in a perl script file:



          #! /usr/bin/perl -an 

          print "$F[0] $F[1]n $F[3] $F[2] @F[4..9]n" .
          " $F[11] $F[10] @F[12..17]n";


          Chmod the file (chmod u+x perlscript), then simply run ./perlscript inputfile.



          And if you need the output in a different file just put > outputfile at the end of the command (this is the same for the first example to use directly on the command line)



          ./perlscript inputfile > outputfile





          share|improve this answer






















          • You know you love it 8-)
            – slm♦
            Sep 2 '13 at 22:29










          • Tried it and it works for me!
            – slm♦
            Sep 2 '13 at 22:30










          • @Drav Sloan, I have the following error massage syntax error at -e line 1, near "." Search pattern not terminated at -e line 1.
            – AiB
            Sep 2 '13 at 22:58










          • This is also how I run the code #!/usr/bin/perl -ane 'print "$F[0] $F[1]n $F[3] $F[2] @F[4..9]n" . " $F[11] $F[10] @F[12..17]n"' veginput
            – AiB
            Sep 2 '13 at 23:00










          • Odd, in which case, remove the " . (new line) " from the command, it shouldn't be an issue...
            – Drav Sloan
            Sep 2 '13 at 23:01

















          up vote
          2
          down vote













          Here's the brute force way using awk :



          $ awk '
          print $1" "$2
          print "t"$4" "$3" "$5,$6,$7,$8,$9,$10
          print "t"$12" "$11" "$13,$14,$15,$16,$17,$18
          ' input.file
          1 2
          0.6007 1 0.1 0.3 0.2 0.7 0.7 0
          0.3073 2 0.1 0.1 0.2 0.4 0.7 0.5
          2 2
          0.4022 1 0.1 0.3 0.2 0.7 0.7 0
          0.5085 2 0.1 0.1 0.2 0.4 0.7 0.5
          3 2
          0.0029 1 0.1 0.3 0.2 0.7 0.7 0
          0.9078 2 0.1 0.1 0.2 0.4 0.7 0.5
          4 2
          0.0692 1 0.1 0.3 0.2 0.7 0.7 0
          0.8805 2 0.1 0.1 0.2 0.4 0.7 0.5


          Here's a slightly more compact version that uses for loops to do the columns that are in series:



          $ awk '
          print $1" "$2
          printf("t%s %s ",$4,$3)
          for(i=5;i<=10;i++)printf("%s ",$i);print ""
          printf("t%s %s ",$12,$11)
          for(i=13;i<=18;i++)printf("%s ",$i);print ""
          ' input.file





          share|improve this answer






















          • Seems your awk-fu is strong young padawan!
            – Drav Sloan
            Sep 2 '13 at 22:31










          • @DravSloan - LOL, thanks for the laugh. It's something 8-)
            – slm♦
            Sep 2 '13 at 22:33










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



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f89186%2fhow-to-select-part-of-the-row-and-pasting-to-form-other-file%23new-answer', 'question_page');

          );

          Post as a guest






























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote













          We're at it again slm :)



          Similar mechanism in perl, from the command line:



          perl -ane 'print "$F[0] $F[1]n $F[3] $F[2] @F[4..9]n" .
          " $F[11] $F[10] @F[12..17]n"' inputfile


          -n processes each line of inputfile as a loop. -a splits each line around the field separator (which defaults to space) and assigns it to the special array @F and -e passes these to the perl command specified (which simply prints the elements in the order required with spacing and newlines where required).



          To put it in a perl script file:



          #! /usr/bin/perl -an 

          print "$F[0] $F[1]n $F[3] $F[2] @F[4..9]n" .
          " $F[11] $F[10] @F[12..17]n";


          Chmod the file (chmod u+x perlscript), then simply run ./perlscript inputfile.



          And if you need the output in a different file just put > outputfile at the end of the command (this is the same for the first example to use directly on the command line)



          ./perlscript inputfile > outputfile





          share|improve this answer






















          • You know you love it 8-)
            – slm♦
            Sep 2 '13 at 22:29










          • Tried it and it works for me!
            – slm♦
            Sep 2 '13 at 22:30










          • @Drav Sloan, I have the following error massage syntax error at -e line 1, near "." Search pattern not terminated at -e line 1.
            – AiB
            Sep 2 '13 at 22:58










          • This is also how I run the code #!/usr/bin/perl -ane 'print "$F[0] $F[1]n $F[3] $F[2] @F[4..9]n" . " $F[11] $F[10] @F[12..17]n"' veginput
            – AiB
            Sep 2 '13 at 23:00










          • Odd, in which case, remove the " . (new line) " from the command, it shouldn't be an issue...
            – Drav Sloan
            Sep 2 '13 at 23:01














          up vote
          2
          down vote













          We're at it again slm :)



          Similar mechanism in perl, from the command line:



          perl -ane 'print "$F[0] $F[1]n $F[3] $F[2] @F[4..9]n" .
          " $F[11] $F[10] @F[12..17]n"' inputfile


          -n processes each line of inputfile as a loop. -a splits each line around the field separator (which defaults to space) and assigns it to the special array @F and -e passes these to the perl command specified (which simply prints the elements in the order required with spacing and newlines where required).



          To put it in a perl script file:



          #! /usr/bin/perl -an 

          print "$F[0] $F[1]n $F[3] $F[2] @F[4..9]n" .
          " $F[11] $F[10] @F[12..17]n";


          Chmod the file (chmod u+x perlscript), then simply run ./perlscript inputfile.



          And if you need the output in a different file just put > outputfile at the end of the command (this is the same for the first example to use directly on the command line)



          ./perlscript inputfile > outputfile





          share|improve this answer






















          • You know you love it 8-)
            – slm♦
            Sep 2 '13 at 22:29










          • Tried it and it works for me!
            – slm♦
            Sep 2 '13 at 22:30










          • @Drav Sloan, I have the following error massage syntax error at -e line 1, near "." Search pattern not terminated at -e line 1.
            – AiB
            Sep 2 '13 at 22:58










          • This is also how I run the code #!/usr/bin/perl -ane 'print "$F[0] $F[1]n $F[3] $F[2] @F[4..9]n" . " $F[11] $F[10] @F[12..17]n"' veginput
            – AiB
            Sep 2 '13 at 23:00










          • Odd, in which case, remove the " . (new line) " from the command, it shouldn't be an issue...
            – Drav Sloan
            Sep 2 '13 at 23:01












          up vote
          2
          down vote










          up vote
          2
          down vote









          We're at it again slm :)



          Similar mechanism in perl, from the command line:



          perl -ane 'print "$F[0] $F[1]n $F[3] $F[2] @F[4..9]n" .
          " $F[11] $F[10] @F[12..17]n"' inputfile


          -n processes each line of inputfile as a loop. -a splits each line around the field separator (which defaults to space) and assigns it to the special array @F and -e passes these to the perl command specified (which simply prints the elements in the order required with spacing and newlines where required).



          To put it in a perl script file:



          #! /usr/bin/perl -an 

          print "$F[0] $F[1]n $F[3] $F[2] @F[4..9]n" .
          " $F[11] $F[10] @F[12..17]n";


          Chmod the file (chmod u+x perlscript), then simply run ./perlscript inputfile.



          And if you need the output in a different file just put > outputfile at the end of the command (this is the same for the first example to use directly on the command line)



          ./perlscript inputfile > outputfile





          share|improve this answer














          We're at it again slm :)



          Similar mechanism in perl, from the command line:



          perl -ane 'print "$F[0] $F[1]n $F[3] $F[2] @F[4..9]n" .
          " $F[11] $F[10] @F[12..17]n"' inputfile


          -n processes each line of inputfile as a loop. -a splits each line around the field separator (which defaults to space) and assigns it to the special array @F and -e passes these to the perl command specified (which simply prints the elements in the order required with spacing and newlines where required).



          To put it in a perl script file:



          #! /usr/bin/perl -an 

          print "$F[0] $F[1]n $F[3] $F[2] @F[4..9]n" .
          " $F[11] $F[10] @F[12..17]n";


          Chmod the file (chmod u+x perlscript), then simply run ./perlscript inputfile.



          And if you need the output in a different file just put > outputfile at the end of the command (this is the same for the first example to use directly on the command line)



          ./perlscript inputfile > outputfile






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 2 '13 at 23:18

























          answered Sep 2 '13 at 22:28









          Drav Sloan

          9,23023038




          9,23023038











          • You know you love it 8-)
            – slm♦
            Sep 2 '13 at 22:29










          • Tried it and it works for me!
            – slm♦
            Sep 2 '13 at 22:30










          • @Drav Sloan, I have the following error massage syntax error at -e line 1, near "." Search pattern not terminated at -e line 1.
            – AiB
            Sep 2 '13 at 22:58










          • This is also how I run the code #!/usr/bin/perl -ane 'print "$F[0] $F[1]n $F[3] $F[2] @F[4..9]n" . " $F[11] $F[10] @F[12..17]n"' veginput
            – AiB
            Sep 2 '13 at 23:00










          • Odd, in which case, remove the " . (new line) " from the command, it shouldn't be an issue...
            – Drav Sloan
            Sep 2 '13 at 23:01
















          • You know you love it 8-)
            – slm♦
            Sep 2 '13 at 22:29










          • Tried it and it works for me!
            – slm♦
            Sep 2 '13 at 22:30










          • @Drav Sloan, I have the following error massage syntax error at -e line 1, near "." Search pattern not terminated at -e line 1.
            – AiB
            Sep 2 '13 at 22:58










          • This is also how I run the code #!/usr/bin/perl -ane 'print "$F[0] $F[1]n $F[3] $F[2] @F[4..9]n" . " $F[11] $F[10] @F[12..17]n"' veginput
            – AiB
            Sep 2 '13 at 23:00










          • Odd, in which case, remove the " . (new line) " from the command, it shouldn't be an issue...
            – Drav Sloan
            Sep 2 '13 at 23:01















          You know you love it 8-)
          – slm♦
          Sep 2 '13 at 22:29




          You know you love it 8-)
          – slm♦
          Sep 2 '13 at 22:29












          Tried it and it works for me!
          – slm♦
          Sep 2 '13 at 22:30




          Tried it and it works for me!
          – slm♦
          Sep 2 '13 at 22:30












          @Drav Sloan, I have the following error massage syntax error at -e line 1, near "." Search pattern not terminated at -e line 1.
          – AiB
          Sep 2 '13 at 22:58




          @Drav Sloan, I have the following error massage syntax error at -e line 1, near "." Search pattern not terminated at -e line 1.
          – AiB
          Sep 2 '13 at 22:58












          This is also how I run the code #!/usr/bin/perl -ane 'print "$F[0] $F[1]n $F[3] $F[2] @F[4..9]n" . " $F[11] $F[10] @F[12..17]n"' veginput
          – AiB
          Sep 2 '13 at 23:00




          This is also how I run the code #!/usr/bin/perl -ane 'print "$F[0] $F[1]n $F[3] $F[2] @F[4..9]n" . " $F[11] $F[10] @F[12..17]n"' veginput
          – AiB
          Sep 2 '13 at 23:00












          Odd, in which case, remove the " . (new line) " from the command, it shouldn't be an issue...
          – Drav Sloan
          Sep 2 '13 at 23:01




          Odd, in which case, remove the " . (new line) " from the command, it shouldn't be an issue...
          – Drav Sloan
          Sep 2 '13 at 23:01












          up vote
          2
          down vote













          Here's the brute force way using awk :



          $ awk '
          print $1" "$2
          print "t"$4" "$3" "$5,$6,$7,$8,$9,$10
          print "t"$12" "$11" "$13,$14,$15,$16,$17,$18
          ' input.file
          1 2
          0.6007 1 0.1 0.3 0.2 0.7 0.7 0
          0.3073 2 0.1 0.1 0.2 0.4 0.7 0.5
          2 2
          0.4022 1 0.1 0.3 0.2 0.7 0.7 0
          0.5085 2 0.1 0.1 0.2 0.4 0.7 0.5
          3 2
          0.0029 1 0.1 0.3 0.2 0.7 0.7 0
          0.9078 2 0.1 0.1 0.2 0.4 0.7 0.5
          4 2
          0.0692 1 0.1 0.3 0.2 0.7 0.7 0
          0.8805 2 0.1 0.1 0.2 0.4 0.7 0.5


          Here's a slightly more compact version that uses for loops to do the columns that are in series:



          $ awk '
          print $1" "$2
          printf("t%s %s ",$4,$3)
          for(i=5;i<=10;i++)printf("%s ",$i);print ""
          printf("t%s %s ",$12,$11)
          for(i=13;i<=18;i++)printf("%s ",$i);print ""
          ' input.file





          share|improve this answer






















          • Seems your awk-fu is strong young padawan!
            – Drav Sloan
            Sep 2 '13 at 22:31










          • @DravSloan - LOL, thanks for the laugh. It's something 8-)
            – slm♦
            Sep 2 '13 at 22:33














          up vote
          2
          down vote













          Here's the brute force way using awk :



          $ awk '
          print $1" "$2
          print "t"$4" "$3" "$5,$6,$7,$8,$9,$10
          print "t"$12" "$11" "$13,$14,$15,$16,$17,$18
          ' input.file
          1 2
          0.6007 1 0.1 0.3 0.2 0.7 0.7 0
          0.3073 2 0.1 0.1 0.2 0.4 0.7 0.5
          2 2
          0.4022 1 0.1 0.3 0.2 0.7 0.7 0
          0.5085 2 0.1 0.1 0.2 0.4 0.7 0.5
          3 2
          0.0029 1 0.1 0.3 0.2 0.7 0.7 0
          0.9078 2 0.1 0.1 0.2 0.4 0.7 0.5
          4 2
          0.0692 1 0.1 0.3 0.2 0.7 0.7 0
          0.8805 2 0.1 0.1 0.2 0.4 0.7 0.5


          Here's a slightly more compact version that uses for loops to do the columns that are in series:



          $ awk '
          print $1" "$2
          printf("t%s %s ",$4,$3)
          for(i=5;i<=10;i++)printf("%s ",$i);print ""
          printf("t%s %s ",$12,$11)
          for(i=13;i<=18;i++)printf("%s ",$i);print ""
          ' input.file





          share|improve this answer






















          • Seems your awk-fu is strong young padawan!
            – Drav Sloan
            Sep 2 '13 at 22:31










          • @DravSloan - LOL, thanks for the laugh. It's something 8-)
            – slm♦
            Sep 2 '13 at 22:33












          up vote
          2
          down vote










          up vote
          2
          down vote









          Here's the brute force way using awk :



          $ awk '
          print $1" "$2
          print "t"$4" "$3" "$5,$6,$7,$8,$9,$10
          print "t"$12" "$11" "$13,$14,$15,$16,$17,$18
          ' input.file
          1 2
          0.6007 1 0.1 0.3 0.2 0.7 0.7 0
          0.3073 2 0.1 0.1 0.2 0.4 0.7 0.5
          2 2
          0.4022 1 0.1 0.3 0.2 0.7 0.7 0
          0.5085 2 0.1 0.1 0.2 0.4 0.7 0.5
          3 2
          0.0029 1 0.1 0.3 0.2 0.7 0.7 0
          0.9078 2 0.1 0.1 0.2 0.4 0.7 0.5
          4 2
          0.0692 1 0.1 0.3 0.2 0.7 0.7 0
          0.8805 2 0.1 0.1 0.2 0.4 0.7 0.5


          Here's a slightly more compact version that uses for loops to do the columns that are in series:



          $ awk '
          print $1" "$2
          printf("t%s %s ",$4,$3)
          for(i=5;i<=10;i++)printf("%s ",$i);print ""
          printf("t%s %s ",$12,$11)
          for(i=13;i<=18;i++)printf("%s ",$i);print ""
          ' input.file





          share|improve this answer














          Here's the brute force way using awk :



          $ awk '
          print $1" "$2
          print "t"$4" "$3" "$5,$6,$7,$8,$9,$10
          print "t"$12" "$11" "$13,$14,$15,$16,$17,$18
          ' input.file
          1 2
          0.6007 1 0.1 0.3 0.2 0.7 0.7 0
          0.3073 2 0.1 0.1 0.2 0.4 0.7 0.5
          2 2
          0.4022 1 0.1 0.3 0.2 0.7 0.7 0
          0.5085 2 0.1 0.1 0.2 0.4 0.7 0.5
          3 2
          0.0029 1 0.1 0.3 0.2 0.7 0.7 0
          0.9078 2 0.1 0.1 0.2 0.4 0.7 0.5
          4 2
          0.0692 1 0.1 0.3 0.2 0.7 0.7 0
          0.8805 2 0.1 0.1 0.2 0.4 0.7 0.5


          Here's a slightly more compact version that uses for loops to do the columns that are in series:



          $ awk '
          print $1" "$2
          printf("t%s %s ",$4,$3)
          for(i=5;i<=10;i++)printf("%s ",$i);print ""
          printf("t%s %s ",$12,$11)
          for(i=13;i<=18;i++)printf("%s ",$i);print ""
          ' input.file






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 31 at 16:45









          Rui F Ribeiro

          36.8k1272117




          36.8k1272117










          answered Sep 2 '13 at 22:25









          slm♦

          239k65494665




          239k65494665











          • Seems your awk-fu is strong young padawan!
            – Drav Sloan
            Sep 2 '13 at 22:31










          • @DravSloan - LOL, thanks for the laugh. It's something 8-)
            – slm♦
            Sep 2 '13 at 22:33
















          • Seems your awk-fu is strong young padawan!
            – Drav Sloan
            Sep 2 '13 at 22:31










          • @DravSloan - LOL, thanks for the laugh. It's something 8-)
            – slm♦
            Sep 2 '13 at 22:33















          Seems your awk-fu is strong young padawan!
          – Drav Sloan
          Sep 2 '13 at 22:31




          Seems your awk-fu is strong young padawan!
          – Drav Sloan
          Sep 2 '13 at 22:31












          @DravSloan - LOL, thanks for the laugh. It's something 8-)
          – slm♦
          Sep 2 '13 at 22:33




          @DravSloan - LOL, thanks for the laugh. It's something 8-)
          – slm♦
          Sep 2 '13 at 22:33

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f89186%2fhow-to-select-part-of-the-row-and-pasting-to-form-other-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?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay