LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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
 
LinkBack 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: 34
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


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bash shell script read file line by line. Darren[UoW] Programming 51 07-04-2013 08:16 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


All times are GMT -5. The time now is 06:43 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration