<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: awk and untarring an entire dir. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599768#M855512</link>
    <description>Chris,&lt;BR /&gt;&lt;BR /&gt;If your idea is to just untar all the tar balls that start with sfib or vins, we don't really need to use loops..&lt;BR /&gt;&lt;BR /&gt;cd /home/s1perf/test_dir&lt;BR /&gt;cp -Rp sfib*.tar test_dump&lt;BR /&gt;cp -Rp vins*.tar test_dump&lt;BR /&gt;cd test_dump&lt;BR /&gt;tar xvf *.tar&lt;BR /&gt;rm *.tar&lt;BR /&gt;&lt;BR /&gt;Is this not what you want?&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
    <pubDate>Tue, 23 Oct 2001 14:56:41 GMT</pubDate>
    <dc:creator>Sridhar Bhaskarla</dc:creator>
    <dc:date>2001-10-23T14:56:41Z</dc:date>
    <item>
      <title>awk and untarring an entire dir.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599764#M855508</link>
      <description>I am at my wits end with this little script.&lt;BR /&gt;The goal is to gather all tar mother balls that have a prefix of 'sfib' or 'vins' and untar them (sfib or vins).&lt;BR /&gt;I have created and output file and I awk the output file to list column $9 and if it meets a certain criteria then follow the logic that is in the script.  What am I doing wrong with my 'while' and 'do' statements? Is there a way for me to untar all tar files within a directory? If anyone can help, I will crown the:-)&lt;BR /&gt;Below is a cut and paste of the script.&lt;BR /&gt;----------------------------------------------&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;&lt;BR /&gt;cd /home/s1perf/test_dir&lt;BR /&gt;ls -l &amp;gt; /home/s1perf/test_dir/mother_tar&lt;BR /&gt;&lt;BR /&gt;awk '{print$9}' /home/s1perf/test_dir/mother_tar | sort | while (read sfib) ; do&lt;BR /&gt;  if  [[ -f $DATA/$sfib.tar ]] ; then&lt;BR /&gt;&lt;BR /&gt;awk '{print $9}' /home/s1perf/test_dir/mother_tar | sort | while read vins ;&lt;BR /&gt;  if  [[ -f $DATA1/$vins.tar ]] ; then&lt;BR /&gt;&lt;BR /&gt;    mv -R /home/s1perf/test_dir/*sfib.tar /home/s1perf/test_dir/test_dump ;&lt;BR /&gt;    mv -R /home/s1perf/test_dir/*vins.tar /home/s1perf/test_dir/test_dump&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;cd /home/s1perf/test_dir/test_dump&lt;BR /&gt;tar -xvf *$9.tar&lt;BR /&gt;etc&lt;BR /&gt;&lt;BR /&gt;chmod 777 */*&lt;BR /&gt;rm *$9.tar&lt;BR /&gt;exit $9.tar&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Oct 2001 14:36:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599764#M855508</guid>
      <dc:creator>Chris Tijerina_2</dc:creator>
      <dc:date>2001-10-23T14:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: awk and untarring an entire dir.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599765#M855509</link>
      <description>Chris,&lt;BR /&gt;&lt;BR /&gt;I think there is some confusion in your scripts and I hope I understand your "prefix" thing.&lt;BR /&gt;&lt;BR /&gt;When you wrote&lt;BR /&gt;&lt;BR /&gt;awk '{print $9}' /home/s1perf/test_dir/mother_tar|sort |while (read sfib)&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;You are not checking for the condition that the prefix should be sfib here.. Right?...&lt;BR /&gt;&lt;BR /&gt;You may want to do this probably...&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;cd /home/s1perf/test_dir&lt;BR /&gt;&lt;BR /&gt;for i in "sfib vins"&lt;BR /&gt;do&lt;BR /&gt;cp -Rp $i*.tar test_dump&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;cd test_dump&lt;BR /&gt;tar xvf *.tar&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Tue, 23 Oct 2001 14:51:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599765#M855509</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-10-23T14:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: awk and untarring an entire dir.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599766#M855510</link>
      <description>Hi Cris,&lt;BR /&gt;&lt;BR /&gt;This should be faily easy.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;dumpdir=cd /where/to/put/them&lt;BR /&gt;cd /where/your/files/are&lt;BR /&gt;ls sfib* vins* | while read line&lt;BR /&gt;do&lt;BR /&gt;mv $line $dumpdir/.&lt;BR /&gt;done&lt;BR /&gt;cd $dumpdir&lt;BR /&gt;for x in `ls *.tar`&lt;BR /&gt;do&lt;BR /&gt;tar xvf $x&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;...jcd...</description>
      <pubDate>Tue, 23 Oct 2001 14:52:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599766#M855510</guid>
      <dc:creator>Joseph C. Denman</dc:creator>
      <dc:date>2001-10-23T14:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: awk and untarring an entire dir.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599767#M855511</link>
      <description>Chris,&lt;BR /&gt;&lt;BR /&gt;Why not do this:&lt;BR /&gt;&lt;BR /&gt;#/bin/ksh&lt;BR /&gt;SRC_DIR=/home/s1perf/test_dir&lt;BR /&gt;DEST_DIR=/home/s1perf/test_dir/test_dump&lt;BR /&gt;&lt;BR /&gt;cd $SRC_DIR&lt;BR /&gt;&lt;BR /&gt;for FILE in $SRC_DIR/*sfib.tar $SRC_DIR/*vins.tar&lt;BR /&gt;do&lt;BR /&gt;  if [[ -r $FILE ]]&lt;BR /&gt;  then&lt;BR /&gt;     FILENAME=$(basename $FILE)&lt;BR /&gt;     mv -R $FILE $DEST_DIR&lt;BR /&gt;     tar xvf $DEST_DIR/$FILENAME&lt;BR /&gt;  fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Or something like that...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-Santosh</description>
      <pubDate>Tue, 23 Oct 2001 14:55:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599767#M855511</guid>
      <dc:creator>Santosh Nair_1</dc:creator>
      <dc:date>2001-10-23T14:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: awk and untarring an entire dir.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599768#M855512</link>
      <description>Chris,&lt;BR /&gt;&lt;BR /&gt;If your idea is to just untar all the tar balls that start with sfib or vins, we don't really need to use loops..&lt;BR /&gt;&lt;BR /&gt;cd /home/s1perf/test_dir&lt;BR /&gt;cp -Rp sfib*.tar test_dump&lt;BR /&gt;cp -Rp vins*.tar test_dump&lt;BR /&gt;cd test_dump&lt;BR /&gt;tar xvf *.tar&lt;BR /&gt;rm *.tar&lt;BR /&gt;&lt;BR /&gt;Is this not what you want?&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Tue, 23 Oct 2001 14:56:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599768#M855512</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-10-23T14:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: awk and untarring an entire dir.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599769#M855513</link>
      <description>Thanks for all the outstanding replies, but I am still working on this issue.  Is there a way for me to untar all the tar files within a dir and not have the shell asks if I want to untar a file, you know, the shell asks if I want to untar; reply with y or n.  How do I suppress this question.  I would like to fully automate this.  Could this be done?  Again I want to thank Joseph, Santosh, Sridhar</description>
      <pubDate>Tue, 23 Oct 2001 17:33:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599769#M855513</guid>
      <dc:creator>Chris Tijerina_2</dc:creator>
      <dc:date>2001-10-23T17:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: awk and untarring an entire dir.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599770#M855514</link>
      <description>tar doesn't normally prompt before untarring a ball.  Has someone in your environment written a wrapper for tar (or are you using a 3rd party tar utility?).  If the latter, man tar might show you the appropriate flag to escape the query.&lt;BR /&gt;&lt;BR /&gt;In the former (or if the man page fails) you can always try "brute force".&lt;BR /&gt;&lt;BR /&gt;y | tar xvf *</description>
      <pubDate>Tue, 23 Oct 2001 17:42:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599770#M855514</guid>
      <dc:creator>Alan Riggs</dc:creator>
      <dc:date>2001-10-23T17:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: awk and untarring an entire dir.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599771#M855515</link>
      <description>Sorry, that should have been:&lt;BR /&gt;&lt;BR /&gt;yes| tar xvf *</description>
      <pubDate>Tue, 23 Oct 2001 17:42:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599771#M855515</guid>
      <dc:creator>Alan Riggs</dc:creator>
      <dc:date>2001-10-23T17:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: awk and untarring an entire dir.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599772#M855516</link>
      <description>The system is on 11.0 and no third party tar utilis are being used.&lt;BR /&gt;Thanks for the response Alan, but I am still getting (untar the follwoing tar file? [y] [n]) prompts when I run the following script:&lt;BR /&gt;----------------------------------------------&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;dumpdir=/home/s1perf/test_dir/test_dump&lt;BR /&gt;cd /home/s1perf/test_dir&lt;BR /&gt;ls sfib* vins* | while read line&lt;BR /&gt;do&lt;BR /&gt;mv $line $dumpdir/.&lt;BR /&gt;done&lt;BR /&gt;cd $dumpdir&lt;BR /&gt;for x in `ls *.tar`&lt;BR /&gt;do&lt;BR /&gt;yes| tar xvf $x&lt;BR /&gt;done</description>
      <pubDate>Tue, 23 Oct 2001 19:43:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599772#M855516</guid>
      <dc:creator>Chris Tijerina_2</dc:creator>
      <dc:date>2001-10-23T19:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: awk and untarring an entire dir.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599773#M855517</link>
      <description>Chris,&lt;BR /&gt;&lt;BR /&gt;It is surprizing. I never saw tar asking &lt;BR /&gt;yes no questions.&lt;BR /&gt;&lt;BR /&gt;Can you manually try to untar without keeping&lt;BR /&gt;it in a script and see if it works?.&lt;BR /&gt;&lt;BR /&gt;#mkdir /tmp/junk;cd /tmp/junk&lt;BR /&gt;#tar xvf /home/s1perf/test_dir/somespecific.tar&lt;BR /&gt;&lt;BR /&gt;See if this asks you yes or no?.&lt;BR /&gt;&lt;BR /&gt;Surprizing :-()&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Tue, 23 Oct 2001 19:51:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599773#M855517</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-10-23T19:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: awk and untarring an entire dir.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599774#M855518</link>
      <description>Very strange.  I untar on 11.00 all the time and have never seen a (y|n) prompt.  Please do run a test manually, perhaps with execute trace on.  Also, what do the following commands return:&lt;BR /&gt;which tar&lt;BR /&gt;what $(which tar)&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Oct 2001 19:58:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599774#M855518</guid>
      <dc:creator>Alan Riggs</dc:creator>
      <dc:date>2001-10-23T19:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: awk and untarring an entire dir.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599775#M855519</link>
      <description>Yahoo!!!  It works, thanks Alan,Sri,Jospeh,Santosh!&lt;BR /&gt;I will not forget to give points.&lt;BR /&gt;&lt;BR /&gt;-Chris</description>
      <pubDate>Tue, 23 Oct 2001 20:34:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-and-untarring-an-entire-dir/m-p/2599775#M855519</guid>
      <dc:creator>Chris Tijerina_2</dc:creator>
      <dc:date>2001-10-23T20:34:25Z</dc:date>
    </item>
  </channel>
</rss>

