Suppose you have a file named "files.txt" that contains the following list of filenames:
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
If you want to tar up the actual files you can do so with this command:
cat files.txt | xargs tar cvzf files.tgz
cat - displays the contents of files.txt
| - pipes the output of cat to xargs
xargs - reads the filenames passed to it by cat, and executes tar with them as arguments
c - create tar file
v - verbose
z - gzip the resulting tar file
f - write to file
files.tgz - the name of the file
I'll stick with windoze
Date: 2007-03-16 04:52 am (UTC)Done
Re: I'll stick with windoze
Date: 2007-03-16 05:46 am (UTC)cat files.txt
with
sed -e 's/ /\\ /g' files.txt. xargs also takes spaces as file delimiters.
Re: I'll stick with windoze
Date: 2007-03-16 07:33 am (UTC)no subject
Date: 2007-03-16 08:01 am (UTC)tar czf --files-from=files.txt files.tgz
Remember to be as lazy as possible when writing scripts.
no subject
Date: 2007-03-16 03:57 pm (UTC)no subject
Date: 2007-03-16 04:47 pm (UTC)no subject
Date: 2007-03-18 09:47 am (UTC)Behold the power of the back tick
Date: 2007-03-17 03:57 am (UTC)tar cvzf files.tgz `cat files.txt`
Re: Behold the power of the back tick
Date: 2007-03-18 09:46 am (UTC)