I am working on a script to install a software distribution which ships as a *.tar.gz file. The company doesn't name the dist consistently, but the resulting directory out of the *.tar.gz file (ie: XXX_X_X_X) is consistent and shows the software version.
I'm writing this with BASH-3.25.x (RHEL).
I'm trying to determine how to reliably grab that root directory name for use inside a script.
I have hacked this:
(the dir always starts with F)
This is a crappy hack, but it works. I looked at the manpage for pax and tar and I didn't see anything obvious that accomplishes what I require.
Anyone have a more elegant/reliable way to do this?
Thanks.
Last edited by Franklin52; 09-20-2011 at 03:15 AM..
Reason: Please use code tags, thank you
anyone know if it is possable to extract a subdirectory in a tar file.
IE
tarfile contains
parent dir
-sub dir A
-sub dir B
I want to extract sub dir B. (2 Replies)
hi everyone
i have a tar file which was in AIX box. its 300mb.
i cant untar in windowsxp home. I just get an empty folder with no files when i extract. i dont get any bad header or any such error.
i am using IZARC which is a freeware. Not sure if i should try winzip or winrar.
any help (2 Replies)
Hi,
I want to view/display the contents of one file in tar file.
For example if the tar file is sam.tar.gz and one of the file inside is E1.txt, how do i view the contents of this E1.txt file.
Olso if I want to extract the E1.txt file only from sam.tar.gz how can i do that.
Thanks in... (7 Replies)
Hi ,
I need to extarct only a particulay files from the tar.Z.
ie
i need to extract one.txt from test.tar.Z.
The test.tar.Z may contain lot of file and folders.
Please help me to extract particular file to some location.
Regards,
Kalai. (1 Reply)
Hi,
Hi recently downloaded the source code from Advanced Programming in the Unix Envrionment 2e and extracted the source from its tar file. The extracted files have these characteristics:
1) They can can be seen in a directory listing and brought up for viewing in emacs;
2) They cannot be... (2 Replies)
I would like to confirm my file.tar is been tar-ed correctly before I remove them. But I have very limited disc space to untar it.
Can I just do the listing instead of actual extract it? Can I say confirm folder integrity if the listing is sucessful without problem?
tar tvf file1.tar
... (1 Reply)
Hi all,
In Solaris howto extract tar file to specific folder.
This is what we do in Linux, but how to do the same thing in Solaris ?
-tar -xzvf /tmp/etc.tar.bz -C /tmp
(Will extract in /tmp dir)
3.gzip COMPRESSION AND EXTRACTION
-tar -czvf /tmp/etc.tar.bz /etc
-du ... (5 Replies)
Hi Guys,
Could you please help to get specific files from /di/data/prd/serial/lookup/abetlp11_lookup_20180206.tar.lzo without extracting whole compressed file tar.lzo as its size is huge
file name - xyz.lkp
Thanks (1 Reply)
I was looking at this tutorial for tar extract Z file. Is there a reason why this did not work? I checked my man pages and it had a -Z option.
tar -xZvf /opt/Nimsoft/nimldr.tar.Z
tar (child): compress: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now... (2 Replies)
Discussion started by: cokedude
2 Replies
LEARN ABOUT DEBIAN
cpan::distnameinfo
CPAN::DistnameInfo(3pm) User Contributed Perl Documentation CPAN::DistnameInfo(3pm)NAME
CPAN::DistnameInfo - Extract distribution name and version from a distribution filename
SYNOPSIS
my $pathname = "authors/id/G/GB/GBARR/CPAN-DistnameInfo-0.02.tar.gz";
my $d = CPAN::DistnameInfo->new($pathname);
my $dist = $d->dist; # "CPAN-DistnameInfo"
my $version = $d->version; # "0.02"
my $maturity = $d->maturity; # "released"
my $filename = $d->filename; # "CPAN-DistnameInfo-0.02.tar.gz"
my $cpanid = $d->cpanid; # "GBARR"
my $distvname = $d->distvname; # "CPAN-DistnameInfo-0.02"
my $extension = $d->extension; # "tar.gz"
my $pathname = $d->pathname; # "authors/id/G/GB/GBARR/..."
my %prop = $d->properties;
DESCRIPTION
Many online services that are centered around CPAN attempt to associate multiple uploads by extracting a distribution name from the
filename of the upload. For most distributions this is easy as they have used ExtUtils::MakeMaker or Module::Build to create the
distribution, which results in a uniform name. But sadly not all uploads are created in this way.
"CPAN::DistnameInfo" uses heuristics that have been learnt by <http://search.cpan.org/> to extract the distribution name and version from
filenames and also report if the version is to be treated as a developer release
The constructor takes a single pathname, returning an object with the following methods
cpanid
If the path given looked like a CPAN authors directory path, then this will be the the CPAN id of the author.
dist
The name of the distribution
distvname
The file name with any suffix and leading directory names removed
filename
If the path given looked like a CPAN authors directory path, then this will be the path to the file relative to the detected CPAN
author directory. Otherwise it is the path that was passed in.
maturity
The maturity of the distribution. This will be either "released" or "developer"
extension
The extension of the distribution, often used to denote the archive type (e.g. 'tar.gz')
pathname
The pathname that was passed to the constructor when creating the object.
properties
This will return a list of key-value pairs, suitable for assigning to a hash, for the known properties.
version
The extracted version
AUTHOR
Graham Barr <gbarr@pobox.com>
COPYRIGHT
Copyright (c) 2003 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same
terms as Perl itself.
perl v5.10.1 2011-03-11 CPAN::DistnameInfo(3pm)