#/bin/bash #script to find a file inside an archive in a specific path if [ $# -eq 2 ] ; then LIST=`find $1 -name '*.tar.gz'` for file in $LIST do result=`tar -tzvf $file | grep -c $2` if [ $result -gt 0 ] ; then echo "Found in $file" echo " `tar -tzvf $file | grep $2`" # tar -tzvf $file fi done else echo usage : $0 path_to_search name_to_find fi exit 0
Friday, November 14, 2008
linux tips : search inside archives
search for a file inside a path containing archives ( .tar.gz .tgz )
I had the following problem :
many archives ( .tar.gz ) and i needed to find where is located a specific file,
so i came up with the following script:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment