The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
use several inputs as arguments in my script chebarbudo Shell Programming and Scripting 2 11-22-2008 07:30 AM
Help how replace stardard keyboard inputs by arguments at run time of a script Dingrong UNIX for Dummies Questions & Answers 6 10-14-2008 04:46 AM
Help in passing array of inputs to C program using script? ahjiefreak Shell Programming and Scripting 1 03-20-2008 07:36 AM
shell script takes long time to complete ozzman Shell Programming and Scripting 12 02-05-2007 11:25 PM
executing a script for a certain amount of time ponchorage Shell Programming and Scripting 9 09-25-2002 05:08 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 03-31-2009
madhul2002 madhul2002 is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 7
need inputs on how i can change my script to reduce amount of time the script takes

HI ,
I have a list1 which consists of data that i have to search and a list2 which has the files that need to be searched .So basically i am using list1 on list2 to see if list1 data is present if found replace it .I have written the code using foreach loop for each list .This is taking the script longer time because the data and the number of files to be search is more....Is there a way i can reduce the time the scripting is takes? I saw somehwere we can use pipe to collect data and doa parallel serach ...but not sure on how to use it

here is teh present code that i have
@list_of_newhier1------------list1
@list_of_newhier-------------list2

foreach $other_list(@list_of_newhier1)
{
chomp(@list_of_newhier1);
if(not ($other_list=~/^\$/) and $other_list=~/\s*(.*).$prefix\.([^\.\t ]+)$/)
{
$other_list=~/\s*(.*).$prefix\.([^\.\t ]+)$\s*/;
$other_list1 = $1;
$other_list2=$2;

foreach $list_of_newhier(@list_of_newhier)
{
chomp(@list_of_newhier);
open(NEWHIER, "$dirname1/$other_list")or die " Can not open $other_list $! \n";
open(NEWHIER1, ">$dirname1/$other_list.tmp")or die " Can not open $other_list.tmp \n";

while(<NEWHIER>)

{


if(/$list_of_newhier/)
{
$_=~s/\b$list_of_newhier\b/$list_of_newhier.$prefix/ ;
}
print NEWHIER1 $_;
}
close(NEWHIER);
close(NEWHIER1);

$sys_err = system("cp $dirname1/$other_list.tmp $dirname1/$other_list");
$sys_err = system(" rm $dirname1/$other_list.tmp");
}
}
}


Thanks
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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




All times are GMT -4. The time now is 07:12 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0