![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 |
| Display Modes | Rate This Thread |
|
|