saving the output of command line in a text file?

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





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















I am using the following command line to analyse data:



unpackdcm -scr $in -targ $out 


This command is printing on the screen status and description about the progress in the job. In order to save the status I did the following:



unpackdcm -scr $in -targ $out >stat.txt


But it did not work.










share|improve this question



















  • 1





    Try unpackdcm -scr $in -targ $out | tee stat.txt.

    – Ramesh
    Oct 21 '14 at 20:48

















3















I am using the following command line to analyse data:



unpackdcm -scr $in -targ $out 


This command is printing on the screen status and description about the progress in the job. In order to save the status I did the following:



unpackdcm -scr $in -targ $out >stat.txt


But it did not work.










share|improve this question



















  • 1





    Try unpackdcm -scr $in -targ $out | tee stat.txt.

    – Ramesh
    Oct 21 '14 at 20:48













3












3








3


1






I am using the following command line to analyse data:



unpackdcm -scr $in -targ $out 


This command is printing on the screen status and description about the progress in the job. In order to save the status I did the following:



unpackdcm -scr $in -targ $out >stat.txt


But it did not work.










share|improve this question
















I am using the following command line to analyse data:



unpackdcm -scr $in -targ $out 


This command is printing on the screen status and description about the progress in the job. In order to save the status I did the following:



unpackdcm -scr $in -targ $out >stat.txt


But it did not work.







shell scripting io-redirection






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 9 at 13:31









Rui F Ribeiro

41.9k1483142




41.9k1483142










asked Oct 21 '14 at 20:47







user88036














  • 1





    Try unpackdcm -scr $in -targ $out | tee stat.txt.

    – Ramesh
    Oct 21 '14 at 20:48












  • 1





    Try unpackdcm -scr $in -targ $out | tee stat.txt.

    – Ramesh
    Oct 21 '14 at 20:48







1




1





Try unpackdcm -scr $in -targ $out | tee stat.txt.

– Ramesh
Oct 21 '14 at 20:48





Try unpackdcm -scr $in -targ $out | tee stat.txt.

– Ramesh
Oct 21 '14 at 20:48










2 Answers
2






active

oldest

votes


















2














The >-sign represents an I/O-Redirection. With >stat.txt you redirect the standard output (stdout) of the application to the file stat.txt. It is redirected, so you will not see any output in the shell.



If you want the output in the current shell AND the file pipe the output into tee:



your_command | tee stat.txt


Or..



your_command | tee -a stat.txt


..to append to the file.



Your application may also produce some errors. They mostly occure in the standard error (see standard streams). To redirect that stream use the folloing syntax:



your_command 2>error.log





share|improve this answer






























    2














    It's possible that the output is being sent to stderr which is not captured by the > operator which only captures stdout.



    Instead, if you are using the bash shell, try routing stderr to stdout and into a file using the &> operator.
    For example:



    unpackdcm -scr $in -targ $out &>stat.txt


    To redirect only stderr, use this:



    unpackdcm -scr $in -targ $out 2>stat.txt





    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%2f163466%2fsaving-the-output-of-command-line-in-a-text-file%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









      2














      The >-sign represents an I/O-Redirection. With >stat.txt you redirect the standard output (stdout) of the application to the file stat.txt. It is redirected, so you will not see any output in the shell.



      If you want the output in the current shell AND the file pipe the output into tee:



      your_command | tee stat.txt


      Or..



      your_command | tee -a stat.txt


      ..to append to the file.



      Your application may also produce some errors. They mostly occure in the standard error (see standard streams). To redirect that stream use the folloing syntax:



      your_command 2>error.log





      share|improve this answer



























        2














        The >-sign represents an I/O-Redirection. With >stat.txt you redirect the standard output (stdout) of the application to the file stat.txt. It is redirected, so you will not see any output in the shell.



        If you want the output in the current shell AND the file pipe the output into tee:



        your_command | tee stat.txt


        Or..



        your_command | tee -a stat.txt


        ..to append to the file.



        Your application may also produce some errors. They mostly occure in the standard error (see standard streams). To redirect that stream use the folloing syntax:



        your_command 2>error.log





        share|improve this answer

























          2












          2








          2







          The >-sign represents an I/O-Redirection. With >stat.txt you redirect the standard output (stdout) of the application to the file stat.txt. It is redirected, so you will not see any output in the shell.



          If you want the output in the current shell AND the file pipe the output into tee:



          your_command | tee stat.txt


          Or..



          your_command | tee -a stat.txt


          ..to append to the file.



          Your application may also produce some errors. They mostly occure in the standard error (see standard streams). To redirect that stream use the folloing syntax:



          your_command 2>error.log





          share|improve this answer













          The >-sign represents an I/O-Redirection. With >stat.txt you redirect the standard output (stdout) of the application to the file stat.txt. It is redirected, so you will not see any output in the shell.



          If you want the output in the current shell AND the file pipe the output into tee:



          your_command | tee stat.txt


          Or..



          your_command | tee -a stat.txt


          ..to append to the file.



          Your application may also produce some errors. They mostly occure in the standard error (see standard streams). To redirect that stream use the folloing syntax:



          your_command 2>error.log






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 21 '14 at 20:56









          chaoschaos

          36.1k977120




          36.1k977120























              2














              It's possible that the output is being sent to stderr which is not captured by the > operator which only captures stdout.



              Instead, if you are using the bash shell, try routing stderr to stdout and into a file using the &> operator.
              For example:



              unpackdcm -scr $in -targ $out &>stat.txt


              To redirect only stderr, use this:



              unpackdcm -scr $in -targ $out 2>stat.txt





              share|improve this answer





























                2














                It's possible that the output is being sent to stderr which is not captured by the > operator which only captures stdout.



                Instead, if you are using the bash shell, try routing stderr to stdout and into a file using the &> operator.
                For example:



                unpackdcm -scr $in -targ $out &>stat.txt


                To redirect only stderr, use this:



                unpackdcm -scr $in -targ $out 2>stat.txt





                share|improve this answer



























                  2












                  2








                  2







                  It's possible that the output is being sent to stderr which is not captured by the > operator which only captures stdout.



                  Instead, if you are using the bash shell, try routing stderr to stdout and into a file using the &> operator.
                  For example:



                  unpackdcm -scr $in -targ $out &>stat.txt


                  To redirect only stderr, use this:



                  unpackdcm -scr $in -targ $out 2>stat.txt





                  share|improve this answer















                  It's possible that the output is being sent to stderr which is not captured by the > operator which only captures stdout.



                  Instead, if you are using the bash shell, try routing stderr to stdout and into a file using the &> operator.
                  For example:



                  unpackdcm -scr $in -targ $out &>stat.txt


                  To redirect only stderr, use this:



                  unpackdcm -scr $in -targ $out 2>stat.txt






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Oct 21 '14 at 21:01









                  terdon

                  133k33268449




                  133k33268449










                  answered Oct 21 '14 at 20:55









                  jonescbjonescb

                  1,60311220




                  1,60311220



























                      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.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f163466%2fsaving-the-output-of-command-line-in-a-text-file%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

                      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?