The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to read record by record from a file in unix raoscb UNIX for Dummies Questions & Answers 1 05-16-2008 03:30 AM
URGENT: Script/Function needed to read text property files in block wise ysreenivas Shell Programming and Scripting 4 03-04-2008 03:20 PM
Urgent for shell script sunnysunny Shell Programming and Scripting 4 03-04-2008 12:42 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-12-2008
Registered User
 

Join Date: Jun 2008
Posts: 25
Shell script failing to read large xml record with many records-Critical urgent help

Hi All,

I have shell script running on AIX 5.3 box. It has 7 to 8 "sed" commands piped(|) together. It has a an Xml file as its input which has many records internally. There are certain record which which have more than hundered tags.The script is taking a huge amount of time more than 1.5 hrs to process the whole xml file.Can any one tell me what is the issue with a solution. I am assuming that lot of swapping is occuring from RAM to Disk and thus it is taking so long a time???

CAn any one suggest if i can allocate memory for this script process at the time of execution???

Thanks in advance!!

Pls respond early!! this is critical!!
Reply With Quote
Forum Sponsor
  #2  
Old 06-12-2008
Registered User
 

Join Date: Jun 2008
Posts: 25
Shell script failing to read large Xml record-urgent critical help

Hi All,

I have shell script running on AIX 5.3 box. It has 7 to 8 "sed" commands piped(|) together. It has a an Xml file as its input which has many records internally. There are certain record which which have more than hundered tags.The script is taking a huge amount of time more than 1.5 hrs to process the whole xml file.Can any one tell me what is the issue with a solution. I am assuming that lot of swapping is occuring from RAM to Disk and thus it is taking so long a time???

CAn any one suggest if i can allocate memory for this script process at the time of execution???

Thanks in advance!!

Pls respond early!! this is critical!!
Reply With Quote
  #3  
Old 06-12-2008
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,262
To give you sound advice it would be necessary to know what the script is, what your input data is and what your desired output is. Post it here (not *all* the data, just a significant sample) and we will think about it.

Lacking any info the best we can do is tell you some generalized hints which may or may not help in your specific case. Here is one: Probably the several sed-calls could be combined to one single script if they are piped one into another. This might speed things considerably.

Another one: maybe you are doing something context-oriented. sed is poor in that and maybe some of its shortcomings are covered by shell constructs. If this is the case you might be better of writing the whole in awk, which will be slower than sed in what sed can do well, but faster than sed and some shell constructs connected in a pipeline.

(For instance: if you try to cut out some part of every line sed is probably faster than then often-seen "awk '{print $5}'", but if the part you are cutting is a number and you want all these numbers totalled at the end than awk is quite better than cutting with sed and adding in a shell loop.)

bakunin
Reply With Quote
  #4  
Old 06-12-2008
Registered User
 

Join Date: Jun 2008
Posts: 25
Hi

i ahve all the sed's piped in the same script and my data consist of multiple Xml records in a xml file and the all the seds in total are taking long time.

I have taken 1 sed command singly and it took 25 mins... and i have 6 more piped along

i don't have much of an option to modify the script... other than something like ....

can we allocate memory (RAM) space [b'coz i have a very very huge RAM] so that swaping of the records may be reduced...

can u suggest something!!!plz plz
Reply With Quote
  #5  
Old 06-12-2008
Moderator
 

Join Date: Sep 2007
Location: Germany
Posts: 1,031
As bakunin says, post your script so people can see what might be redundant or can be written more efficient. And again no no no, there is no allocating memory for shell scripts on AIX, not even on other derivates I think.
You can check if your ulimits might be set too low. Else tune your machine so it won't swap with vmo. But this is another issue.

And please do not spam "plz" - it sounds like a 14 year old in World of Warcraft. Sorry, but couldn't resist.
Reply With Quote
  #6  
Old 06-12-2008
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,610
Quote:
It has 7 to 8 "sed" commands piped(|) together.
One suggestion what I could say is ( not complete though )

if you are using sed commands like

Code:
sed 's/abc/def/g' filename | sed 's/rty/uty/g'
it can be combined as

Code:
sed 's/abc/def/g;s/rty/uty/g' filename
Second one would be much faster, as there is only one sed command ( process ) and iterations going on ( no Kernel Data Structure even )

Quote:
Pls respond early!! this is critical!!
This is a relative term and not encouraged here.
Reply With Quote
  #7  
Old 06-12-2008
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
Every time you execute a pipe you create a child process. This is expensive and consumes huge amounts of resource.

You can get past this by doing things like creating co-processes, or setting up cooperating processes. Again we need to see the "seven" pipes to sed. Which is very likely the bottleneck - but that is a guess.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 01:47 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0