LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-30-2011, 04:02 AM   #1
mahi_nix
Member
 
Registered: Aug 2010
Distribution: CentOS, RHEL, Ubuntu,
Posts: 154

Rep: Reputation: 16
Angry Gunzip command limitation


Hi Folk,

I am facing one problem realted to Gunzip and Cat command need your help to sorted out this issue in ungent bases.

i have more that 3000 to 4000 files which is in .gz format. now i want to gunzip this all files in single command and also redirect all files data in one file.

for unzip the files i am running the command
## sudo gunzip *
If i have more than 3000 zip files it shows error "sudo: unable to execute /bin/gunzip: Argument list too long"

and for redirect all files data i am using
## sudo cat <Path of The Firectory/*> >> <Redirected_file_name>

If i have more that 3000 files then i am getting error "sudo: unable to execute /bin/cat: Argument list too long"

Please help me to sorted out this issue. how can i unzip and redirect more that 3000 files.

Thanks in Advanced,
 
Old 08-30-2011, 04:10 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Do a loop. Furthermore you can use the -c option of gzip to send the uncompressed data to the standard output, so that you can redirect it at your pleasure:
Code:
for file in *.gz
do
  gzip -c -d "$file" >> redirected_file_name
done
If you have to use sudo and it asks for password, better to do sudo -i before the loop in order to acquire privileges permanently.
 
1 members found this post helpful.
Old 08-31-2011, 02:38 AM   #3
mahi_nix
Member
 
Registered: Aug 2010
Distribution: CentOS, RHEL, Ubuntu,
Posts: 154

Original Poster
Rep: Reputation: 16
Thumbs up

Hi colucix,

Thanks for the prompt reply.

Your suggested Configuration has helped me a lot.

Thanks for you suggetion Colucix.
 
Old 08-31-2011, 03:03 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
You're welcome!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Gunzip a File and then execute tar it in one command networkingnub Programming 2 01-15-2010 04:56 PM
using gunzip ekdya Debian 2 04-11-2006 09:05 AM
command tar: - ? gunzip or no ? eeried Linux - Newbie 4 04-06-2005 01:59 PM
speed limitation with scp command? naijaguy Linux - Networking 2 03-18-2005 02:30 PM
gunzip command ronss Linux - Newbie 3 03-21-2002 01:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration