Tag Info

Hot answers tagged

9

You could try unzip -t zipfile.zip | awk '{print $2}' | tail -n +2 | xargs echo or unzip -t zipfile.zip | awk '{print $2}' | sed 's/zipfile.zip//' | xargs echo and if you have spaces in filenames unzip -l zipfile.zip | tail -n +4 | head -n -2 | awk '{print "\""substr($0,index($0,$4))"\""}' | xargs rm check that the output is sensible and then ...


6

If you're risking overwriting files in production with uncertain results, you're doing something wrong. Test first. tar zxvf archive.tar.gz path/to/file/in/archive -C /destination/dir


5

Iain's answer threw a head-related error on my machine that I couldn't figure out... so I went ahead and wrote little BASH script that includes part of his solution, and that works quite nicely... just pass the original zip as an argument to this ununzip.sh script.. Comment the rm line to preview the "action". #!/bin/bash COUNT=0 ...


4

In case anyone else comes across this (as I just have) there are some reasonably detailed (and mostly correct) steps over here. Key details The key point is to unpack all of the duplicity-full.*.difftar.gz files in the same place, so that you're left with just two snapshot/ and multivol_snapshot/ directories. If your file is in snapshot/ then you're done. ...


3

Though this won't install the package, you can transfer them from a package file (aka a datastream package) to a spool location with the pkgtrans command: pkgtrans filename.pkg /home/user/temporary_package_prefix This will extract the package file system hierarchy as well as the pkginfo file and any pre/post install scripts into your directory.


3

I just manually delete the crud, whilst strenuously admonishing myself for not checking the zip file was sensibly formed (which they invariably aren't) with unzip -l first.


3

Try this: $ unzip -l scrubbers.zip | sed '1,3d' | sed 'N;$!P;$!D;$d' | awk '{ print $4 }' | xargs rm -fr


3

$ find /path/to/files -name "*.gz" -print0 | xargs -0 gunzip


3

I believe that tar uses the /tmp directory for intermediate files. You have a couple of options. One is to mount /tmp to a larger disk in your fstab. But that's a bit overkill. Instead, you can set the $TMPDIR environment variable. If present, tar will use that instead of /tmp.


2

I had problem running the script from Windows Vista. When I ran the code nothing happend. I needed to be administrator to be able to run the script. When I right clicked on the .bat file and "run as administrator" it didn't work because it for some reason started in the system32 folder (if I remember correctly). To solve this simply use the Windows ...


1

FYI, if you have a Windows 7 64 bit OS, the correct path is "Program Files (x86)" for 7zip. Below is the script that worked for me. > @echo on cd %~dp0 > > FOR /D /r %%F in ("*") DO ( pushd %CD% cd %%F > FOR %%X in (*.rar *.zip) DO ( > "C:\Program Files (x86)\7-zip\7z.exe" x %%X > ) popd )


1

You could try other versions of tar: gnu tar, star, bsdtar, etc. One of them might handle errors better. You say your files are all text files, so you should be able to manually edit the file and select each file and copy/paste it to a new file. Look for tar's separator between each file, it looks like a block of ASCII NULLs with the file's metadata ...


1

There is nothing in GNU cpio to allow for this. This might be a little cleaner: (cd /some/dir && cpio -whatever < somefile) Using the subshell parentheses will preserve the scripts current working directory and using && will ensure that the cpio extraction is only done if you successfully change directories to the target.


1

Do you want to get this information locally or from remote? You could execute the following command as well: $ httpd -v Server version: Apache/2.2.13 (Unix) Server built: Aug 18 2009 06:16:17


1

On Solaris 10 if you have a tar ball called myTarfile.tar and you want to extract only one directory called my_dir from that tar file then below command workes tar -xvf myTarfile.tar -C my_dir


1

Try 'cpio -F corrupt.tar -i -v' and never use irc to transfer large files.


1

Without CVSROOT, cvs knows absolutely nothing about what's in your folder, since all of the file and version information was in that one CVSROOT directory. What you'll have to do is use RCS to extract the most recent version of each ,v file, individually, which should work with something like the following in bash: for fn in *,v; do co ${fn%,v} done ...


1

It seems that all the necessary information is contained within the ,v files and Attic directories within my partial repository. The key is to simply create an empty CVS root with cvs -d /workingdir init and then copy the original (partial) repository folder into workingdir. At that point a simple cvs -d /workingdir co B2MEj (or whatever your project name ...


1

How about download the required archive and then make like this: duplicity scp://uid@other.host//usr/backup restored_dir (example from official site)


1

find . -name "*.zip" | while read filename; do unzip -o -d "`dirname "$filename"`" "$filename"; done; Starts a recursive search at the current directory, finds all files ending in .zip, then pipes that into a loop. For every file it finds, it runs an unzip command on the file with the output shunted to the file's directory.


1

$ while read p; do awk '$1 == "'$p'"' file2; done < file1 or: $ awk -F'\t' 'FNR==NR { a[$0]; next } $1 in a' file1 file2 FNR: the number of records read from the current file being processed NR: total number of input records FNR==NR: is only true when awk is reading the file1 a[$0]: create an array element indexed by $0 (from file1) $1 in a: check ...


1

bash code to do this: for i in $(cat file1); do egrep "^$i\s" file2; done


1

This is probably the fastest: grep -f <( sed 's/.*/^&\t/' file1) file2 The answers using for and while loops are going to be very slow. The awk answer by quanta should work. I don't know why it wouldn't unless your line endings are non-Unix or file1 is very big.


1

7Zip can read VHD files and extract the contents (though NTFS Extended Attributes and such will be ignored). It can also read disk images with NTFS partitions, as well as WIM files.



Only top voted, non community-wiki answers of a minimum length are eligible