The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
please explain the below mail2sant Shell Programming and Scripting 1 04-04-2008 05:04 AM
Please can any one explain this ${0##/} gadege Shell Programming and Scripting 2 04-01-2008 12:26 PM
Can anyone explain plz r_W213 UNIX for Advanced & Expert Users 3 03-27-2007 01:52 AM
if [ $? -eq 0 ] .. can someone explain this? ranjita.c Shell Programming and Scripting 5 10-03-2006 04:50 PM
Explain awk hitmansilentass Shell Programming and Scripting 4 09-27-2006 11:14 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 04-03-2008
Registered User
 

Join Date: Apr 2008
Posts: 1
Exclamation explain plz

can u explain this step by step........plz...will it do the same

for I in *.tar.gz; do
A=`basename $I .tar.gz`
mkdir $A
cp marking-guide ${A}/$A
cd $A
gunzip -c ../$I | tar xf -
cd..
done


thnx
__________________
Reply With Quote
Forum Sponsor
  #2  
Old 04-03-2008
joeyg's Avatar
Moderator
 

Join Date: Dec 2007
Location: Home of world champion Boston Celtics
Posts: 934
Wink Here is some of it anyway

# loop thru all zip file archives (files ending .tar.gz)
for I in *.tar.gz; do
# set var A to whatever is before the .tar.gz
A=`basename $I .tar.gz`
# make a directory for the var A
mkdir $A
# copy file marking-guide to __
cp marking-guide ${A}/$A
# change directory to A
cd $A
# unzip __
gunzip -c ../$I | tar xf -
# change directory to one back
cd..
# done with loop
done
Reply With Quote
  #3  
Old 04-03-2008
Registered User
 

Join Date: Jun 2006
Posts: 164
For each filename ending in .tar.gz (gzipped tar file)
for I in *.tar.gz; do

Filename without any path (including the .tar.gz)
A=`basename $I .tar.gz`
Make a directory with the same name as the file
mkdir $A
Copy something called marking-guide into the new directory with the same name as the .tar.gz file
cp marking-guide ${A}/$A
Move into the directory and decompress the file
cd $A
gunzip -c ../$I | tar xf -
Go back to the original directory in case there are more iterations of the loop
cd..
done
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:06 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0