I want to create a zipped output file while keeping the original one











up vote
1
down vote

favorite












I want to create a zipped output file while keeping the original one. I want to do it from Informatica end by using command task or session task.



Below is the example which I am trying:




  1. In session task: Command type='Command',
    Command=
    gzip -c /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out



  2. In case of using Command task:



    gzip -c /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out




I tried both things, but zip file is not at all created.



Below is the screen shot:



command in session task










share|improve this question




























    up vote
    1
    down vote

    favorite












    I want to create a zipped output file while keeping the original one. I want to do it from Informatica end by using command task or session task.



    Below is the example which I am trying:




    1. In session task: Command type='Command',
      Command=
      gzip -c /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out



    2. In case of using Command task:



      gzip -c /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out




    I tried both things, but zip file is not at all created.



    Below is the screen shot:



    command in session task










    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I want to create a zipped output file while keeping the original one. I want to do it from Informatica end by using command task or session task.



      Below is the example which I am trying:




      1. In session task: Command type='Command',
        Command=
        gzip -c /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out



      2. In case of using Command task:



        gzip -c /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out




      I tried both things, but zip file is not at all created.



      Below is the screen shot:



      command in session task










      share|improve this question















      I want to create a zipped output file while keeping the original one. I want to do it from Informatica end by using command task or session task.



      Below is the example which I am trying:




      1. In session task: Command type='Command',
        Command=
        gzip -c /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out



      2. In case of using Command task:



        gzip -c /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out




      I tried both things, but zip file is not at all created.



      Below is the screen shot:



      command in session task







      shell-script






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 25 at 22:34









      Rui F Ribeiro

      38.3k1477127




      38.3k1477127










      asked Mar 21 '14 at 9:22









      Infa_unix

      613




      613






















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          4
          down vote













          You can keep original file by using -c options and redirect output to another file:



          gzip -c file > file.gz


          It will keep your original file unchange and create its gzip file named file.gz






          share|improve this answer




























            up vote
            0
            down vote













            Your zip file isn't being created because the -c option for gzip means that the compressed file is sent to stdout instead of being written to disk. For what you want, you could either do what Laurent suggested in his comment, or you could use zip instead of gzip, which leaves the original files as well as creating a .zip file:



            zip /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out.zip /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out


            Or:



            cd /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/ && zip tgt_zip tgt_zip





            share|improve this answer




























              up vote
              0
              down vote













              gzip -c reads a file (or standard input when file name is - ) and writes a compressed version to standard output.



              So save contents to a new file then stdout redirection can be used.



              gzip -c inputfile >outputfile


              To simply compress in place and produce inputfile.gz



              gzip inputfile


              If informatica is ignoring the stdout redirection, you could pass the whole command to a shell (sh, csh, bash, ...) and let it do it instead,



              Command=sh -c "gzip -c filename > newfilename"


              I'm not an informatica user, so their forum for more information on that product here.



              edit 1



              Here's a simple script to use from informatica which hides i/o redirection.



              $ cat infagzip.sh 
              #!/bin/sh

              if [ $# -ne 2 ]
              then
              echo "Usage $0 : inputfile outputfile "
              exit 1
              fi
              gzip -c "$1" > "$2"


              Now your Command line should look like this



              /path/to/infagzip.sh inputfilename outputfilename





              share|improve this answer























              • I tried above logic but end up with below error: Error: [tgt_zip] Process id 17626. The shell command failed with exit code 1.
                – Infa_unix
                Mar 21 '14 at 10:18












              • Your problem appears to be the informatica interface, write a simple shell command that just takes the parameters you require which can hide redirection and punctuation characters to informatica if this is causing the problem. BTW, you didn't try the sh method above.
                – X Tian
                Mar 21 '14 at 10:35












              • @X Tian, if I ran first command in putty, it is giving expected result, but not in Inforamatica. I tried sh method also. its not working at Infa level.
                – Infa_unix
                Mar 21 '14 at 11:18










              • Write a simple shell script to do what you want. and call that instead of gzip directly.
                – X Tian
                Mar 21 '14 at 11:19











              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: 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%2f120723%2fi-want-to-create-a-zipped-output-file-while-keeping-the-original-one%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              4
              down vote













              You can keep original file by using -c options and redirect output to another file:



              gzip -c file > file.gz


              It will keep your original file unchange and create its gzip file named file.gz






              share|improve this answer

























                up vote
                4
                down vote













                You can keep original file by using -c options and redirect output to another file:



                gzip -c file > file.gz


                It will keep your original file unchange and create its gzip file named file.gz






                share|improve this answer























                  up vote
                  4
                  down vote










                  up vote
                  4
                  down vote









                  You can keep original file by using -c options and redirect output to another file:



                  gzip -c file > file.gz


                  It will keep your original file unchange and create its gzip file named file.gz






                  share|improve this answer












                  You can keep original file by using -c options and redirect output to another file:



                  gzip -c file > file.gz


                  It will keep your original file unchange and create its gzip file named file.gz







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 21 '14 at 10:04









                  cuonglm

                  101k23197299




                  101k23197299
























                      up vote
                      0
                      down vote













                      Your zip file isn't being created because the -c option for gzip means that the compressed file is sent to stdout instead of being written to disk. For what you want, you could either do what Laurent suggested in his comment, or you could use zip instead of gzip, which leaves the original files as well as creating a .zip file:



                      zip /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out.zip /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out


                      Or:



                      cd /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/ && zip tgt_zip tgt_zip





                      share|improve this answer

























                        up vote
                        0
                        down vote













                        Your zip file isn't being created because the -c option for gzip means that the compressed file is sent to stdout instead of being written to disk. For what you want, you could either do what Laurent suggested in his comment, or you could use zip instead of gzip, which leaves the original files as well as creating a .zip file:



                        zip /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out.zip /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out


                        Or:



                        cd /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/ && zip tgt_zip tgt_zip





                        share|improve this answer























                          up vote
                          0
                          down vote










                          up vote
                          0
                          down vote









                          Your zip file isn't being created because the -c option for gzip means that the compressed file is sent to stdout instead of being written to disk. For what you want, you could either do what Laurent suggested in his comment, or you could use zip instead of gzip, which leaves the original files as well as creating a .zip file:



                          zip /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out.zip /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out


                          Or:



                          cd /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/ && zip tgt_zip tgt_zip





                          share|improve this answer












                          Your zip file isn't being created because the -c option for gzip means that the compressed file is sent to stdout instead of being written to disk. For what you want, you could either do what Laurent suggested in his comment, or you could use zip instead of gzip, which leaves the original files as well as creating a .zip file:



                          zip /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out.zip /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/tgt_zip.out


                          Or:



                          cd /var/opt/powermart/pc8_dev/infa_shared/TgtFiles/test1/ && zip tgt_zip tgt_zip






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 21 '14 at 9:56









                          Josh Jolly

                          1,322812




                          1,322812






















                              up vote
                              0
                              down vote













                              gzip -c reads a file (or standard input when file name is - ) and writes a compressed version to standard output.



                              So save contents to a new file then stdout redirection can be used.



                              gzip -c inputfile >outputfile


                              To simply compress in place and produce inputfile.gz



                              gzip inputfile


                              If informatica is ignoring the stdout redirection, you could pass the whole command to a shell (sh, csh, bash, ...) and let it do it instead,



                              Command=sh -c "gzip -c filename > newfilename"


                              I'm not an informatica user, so their forum for more information on that product here.



                              edit 1



                              Here's a simple script to use from informatica which hides i/o redirection.



                              $ cat infagzip.sh 
                              #!/bin/sh

                              if [ $# -ne 2 ]
                              then
                              echo "Usage $0 : inputfile outputfile "
                              exit 1
                              fi
                              gzip -c "$1" > "$2"


                              Now your Command line should look like this



                              /path/to/infagzip.sh inputfilename outputfilename





                              share|improve this answer























                              • I tried above logic but end up with below error: Error: [tgt_zip] Process id 17626. The shell command failed with exit code 1.
                                – Infa_unix
                                Mar 21 '14 at 10:18












                              • Your problem appears to be the informatica interface, write a simple shell command that just takes the parameters you require which can hide redirection and punctuation characters to informatica if this is causing the problem. BTW, you didn't try the sh method above.
                                – X Tian
                                Mar 21 '14 at 10:35












                              • @X Tian, if I ran first command in putty, it is giving expected result, but not in Inforamatica. I tried sh method also. its not working at Infa level.
                                – Infa_unix
                                Mar 21 '14 at 11:18










                              • Write a simple shell script to do what you want. and call that instead of gzip directly.
                                – X Tian
                                Mar 21 '14 at 11:19















                              up vote
                              0
                              down vote













                              gzip -c reads a file (or standard input when file name is - ) and writes a compressed version to standard output.



                              So save contents to a new file then stdout redirection can be used.



                              gzip -c inputfile >outputfile


                              To simply compress in place and produce inputfile.gz



                              gzip inputfile


                              If informatica is ignoring the stdout redirection, you could pass the whole command to a shell (sh, csh, bash, ...) and let it do it instead,



                              Command=sh -c "gzip -c filename > newfilename"


                              I'm not an informatica user, so their forum for more information on that product here.



                              edit 1



                              Here's a simple script to use from informatica which hides i/o redirection.



                              $ cat infagzip.sh 
                              #!/bin/sh

                              if [ $# -ne 2 ]
                              then
                              echo "Usage $0 : inputfile outputfile "
                              exit 1
                              fi
                              gzip -c "$1" > "$2"


                              Now your Command line should look like this



                              /path/to/infagzip.sh inputfilename outputfilename





                              share|improve this answer























                              • I tried above logic but end up with below error: Error: [tgt_zip] Process id 17626. The shell command failed with exit code 1.
                                – Infa_unix
                                Mar 21 '14 at 10:18












                              • Your problem appears to be the informatica interface, write a simple shell command that just takes the parameters you require which can hide redirection and punctuation characters to informatica if this is causing the problem. BTW, you didn't try the sh method above.
                                – X Tian
                                Mar 21 '14 at 10:35












                              • @X Tian, if I ran first command in putty, it is giving expected result, but not in Inforamatica. I tried sh method also. its not working at Infa level.
                                – Infa_unix
                                Mar 21 '14 at 11:18










                              • Write a simple shell script to do what you want. and call that instead of gzip directly.
                                – X Tian
                                Mar 21 '14 at 11:19













                              up vote
                              0
                              down vote










                              up vote
                              0
                              down vote









                              gzip -c reads a file (or standard input when file name is - ) and writes a compressed version to standard output.



                              So save contents to a new file then stdout redirection can be used.



                              gzip -c inputfile >outputfile


                              To simply compress in place and produce inputfile.gz



                              gzip inputfile


                              If informatica is ignoring the stdout redirection, you could pass the whole command to a shell (sh, csh, bash, ...) and let it do it instead,



                              Command=sh -c "gzip -c filename > newfilename"


                              I'm not an informatica user, so their forum for more information on that product here.



                              edit 1



                              Here's a simple script to use from informatica which hides i/o redirection.



                              $ cat infagzip.sh 
                              #!/bin/sh

                              if [ $# -ne 2 ]
                              then
                              echo "Usage $0 : inputfile outputfile "
                              exit 1
                              fi
                              gzip -c "$1" > "$2"


                              Now your Command line should look like this



                              /path/to/infagzip.sh inputfilename outputfilename





                              share|improve this answer














                              gzip -c reads a file (or standard input when file name is - ) and writes a compressed version to standard output.



                              So save contents to a new file then stdout redirection can be used.



                              gzip -c inputfile >outputfile


                              To simply compress in place and produce inputfile.gz



                              gzip inputfile


                              If informatica is ignoring the stdout redirection, you could pass the whole command to a shell (sh, csh, bash, ...) and let it do it instead,



                              Command=sh -c "gzip -c filename > newfilename"


                              I'm not an informatica user, so their forum for more information on that product here.



                              edit 1



                              Here's a simple script to use from informatica which hides i/o redirection.



                              $ cat infagzip.sh 
                              #!/bin/sh

                              if [ $# -ne 2 ]
                              then
                              echo "Usage $0 : inputfile outputfile "
                              exit 1
                              fi
                              gzip -c "$1" > "$2"


                              Now your Command line should look like this



                              /path/to/infagzip.sh inputfilename outputfilename






                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Mar 21 '14 at 11:37

























                              answered Mar 21 '14 at 10:07









                              X Tian

                              7,57111936




                              7,57111936












                              • I tried above logic but end up with below error: Error: [tgt_zip] Process id 17626. The shell command failed with exit code 1.
                                – Infa_unix
                                Mar 21 '14 at 10:18












                              • Your problem appears to be the informatica interface, write a simple shell command that just takes the parameters you require which can hide redirection and punctuation characters to informatica if this is causing the problem. BTW, you didn't try the sh method above.
                                – X Tian
                                Mar 21 '14 at 10:35












                              • @X Tian, if I ran first command in putty, it is giving expected result, but not in Inforamatica. I tried sh method also. its not working at Infa level.
                                – Infa_unix
                                Mar 21 '14 at 11:18










                              • Write a simple shell script to do what you want. and call that instead of gzip directly.
                                – X Tian
                                Mar 21 '14 at 11:19


















                              • I tried above logic but end up with below error: Error: [tgt_zip] Process id 17626. The shell command failed with exit code 1.
                                – Infa_unix
                                Mar 21 '14 at 10:18












                              • Your problem appears to be the informatica interface, write a simple shell command that just takes the parameters you require which can hide redirection and punctuation characters to informatica if this is causing the problem. BTW, you didn't try the sh method above.
                                – X Tian
                                Mar 21 '14 at 10:35












                              • @X Tian, if I ran first command in putty, it is giving expected result, but not in Inforamatica. I tried sh method also. its not working at Infa level.
                                – Infa_unix
                                Mar 21 '14 at 11:18










                              • Write a simple shell script to do what you want. and call that instead of gzip directly.
                                – X Tian
                                Mar 21 '14 at 11:19
















                              I tried above logic but end up with below error: Error: [tgt_zip] Process id 17626. The shell command failed with exit code 1.
                              – Infa_unix
                              Mar 21 '14 at 10:18






                              I tried above logic but end up with below error: Error: [tgt_zip] Process id 17626. The shell command failed with exit code 1.
                              – Infa_unix
                              Mar 21 '14 at 10:18














                              Your problem appears to be the informatica interface, write a simple shell command that just takes the parameters you require which can hide redirection and punctuation characters to informatica if this is causing the problem. BTW, you didn't try the sh method above.
                              – X Tian
                              Mar 21 '14 at 10:35






                              Your problem appears to be the informatica interface, write a simple shell command that just takes the parameters you require which can hide redirection and punctuation characters to informatica if this is causing the problem. BTW, you didn't try the sh method above.
                              – X Tian
                              Mar 21 '14 at 10:35














                              @X Tian, if I ran first command in putty, it is giving expected result, but not in Inforamatica. I tried sh method also. its not working at Infa level.
                              – Infa_unix
                              Mar 21 '14 at 11:18




                              @X Tian, if I ran first command in putty, it is giving expected result, but not in Inforamatica. I tried sh method also. its not working at Infa level.
                              – Infa_unix
                              Mar 21 '14 at 11:18












                              Write a simple shell script to do what you want. and call that instead of gzip directly.
                              – X Tian
                              Mar 21 '14 at 11:19




                              Write a simple shell script to do what you want. and call that instead of gzip directly.
                              – X Tian
                              Mar 21 '14 at 11:19


















                              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%2f120723%2fi-want-to-create-a-zipped-output-file-while-keeping-the-original-one%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

                              List directoties down one level, excluding some named directories and files

                              list processes belonging to a network namespace

                              list systemd RuntimeDirectory mounts