LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 03: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, 03:10 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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, 01: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, 02:03 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

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


Reply



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 03:56 PM
using gunzip ekdya Debian 2 04-11-2006 08:05 AM
command tar: - ? gunzip or no ? eeried Linux - Newbie 4 04-06-2005 12:59 PM
speed limitation with scp command? naijaguy Linux - Networking 2 03-18-2005 01:30 PM
gunzip command ronss Linux - Newbie 3 03-21-2002 12:04 PM

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

All times are GMT -5. The time now is 09:31 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
Open Source Consulting | Domain Registration