LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-22-2004, 02:07 AM   #1
saravanan1979
Member
 
Registered: Jan 2002
Posts: 163

Rep: Reputation: 30
Shell Script to read 500files from the command line


Hi,
I use a shell script(see below) which takes 500 *.gz files(space separated) from the command line zcats them and passes the output to a second command via pipe pipe.(cmd a |cmd b|cmd c).But this method produces a data loss.Either all files are not read or the complete output is not escalated over the pipe.There is no error message returned.

Ps:The entire command(myzcat .sh @filelist|cmd b|cmd c ) is executed in Perl using IPC::Run module.The script has been thoroughly checked and defnitely 500 files are passsed as input to it.

Can anyone help me out in identifying the problem.

Shell Script used
------------------

filelist=$*
echo "$filelist"|xargs zcat
if [ $? -eq 2 ]; then
exit 0
fi
~
 
Old 09-22-2004, 09:44 AM   #2
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 36
try:
Code:
for file in `echo $*`
do
   zcat $file
done
exit
It is possible to get odd behavior from either perl or shell by passing so many arguments. It's not the number of arguments but the total numbers of the characters.

I would make sure you don't pass more than 4096 characters at a time.
 
  


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
bash shell script read file line by line. Darren[UoW] Programming 57 04-17-2016 06:07 PM
how to pass command-line parameter to shell script? Kropotkin Linux - Newbie 12 07-25-2011 09:24 AM
shell script that read each line separatly xpucto Programming 6 09-20-2005 08:06 AM
How to execute a command line in a shell script orgazmo Programming 5 05-09-2005 09:16 AM
Perl shell-out to script dunna work. Works on command line. Why? jlangelier Linux - Software 1 08-28-2004 02:00 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:18 PM.

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