You don't need awk (or similar) to improve the performance of your script. Just by the look on it, it can be seen that you run six commands (= six new processes) in the inner loop, times 50 for the lines in file 2, times millions for the lines in file1 (opening file2 millions times (even though buffered/cached)).
With your input data, and after cleaning out a few quirks in your code snippet, I find
, while
with YY being
An even faster solution might be to use an array to hold file2's contents, and have the outer loop read file1, and an inner loop to iterate through the array doing the comparisons/modifications.
---------- Post updated at 22:00 ---------- Previous update was at 21:36 ----------
Modification using arrays; adapt to taste...:
Timing is similar to the first version; looks like the disk cache is quite powerful:
Hi, everybody.
I just wonder whether there are a couple of free Linux servers running as terminals where people can practice Unix Shell Programming?
I'd like to set up one myself but unfortunatly can't do it. I can't switch to Linux now coz I run a couple of servers on my machine.
Cygwin is... (3 Replies)
About 4 years ago I wrote this tool inspired by Rob Urban's collect tool for DEC's Tru64 Unix. What makes this tool as different as collect was in its day is its ability to run at a low overhead and collect tons of stuff. I've expanded the general concept and even include data not available in... (0 Replies)
I am doing the following script in k shell
sed -i 's/FILENAME/$i/g' TEST/test$j.ctl > TEST/control$j.ctl
In the file it replaces $i for all FILENAME, it doesnot replace with the value of i. I put single quotes like below
sed -i 's/FILENAME/'$i'/g' TEST/test$j.ctl > TEST/control$j.ctl
I... (9 Replies)
We develop software for diagnostic tools for cars. we a use a portable PC(x86) runs Win98 to run our applications.
Hence the working environment in the company is Windows, specifically we use BASIC to develop the GUI, communication functions, DLL, etc. and run them on the Win98 PC.
We suggested... (1 Reply)
Hello All,
Request any one of Unix/Linux masters to clarify on the below.
How far it is feasible to open a new ftp connection for transferring each file when there are multiple files to be sent. I have developed shell script to send all files at single stretch but some how it doesnt suit to... (3 Replies)
One of our database server is suddenly became very slow and i have no clue what to do .Please help. I m sharing the performance inforamtion regarding cpu,harddisk,ram .
########CPU Information########
Machine Uptime Information:
uptime
10:25:06 up 16:50, 1 user, load average: 5.84, 5.65,... (10 Replies)
Hi,
I have been working on Sun Solaris since a long time. Recently I got to work on RH Linux. My Linux version details are:
Linux 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
I have a simple command in my shell script:
export BKPTAG=`date... (3 Replies)
IN solaris, for network high-availability we are using IPMP concept, can u tell me in REDHAT LINUX what we are using... also pls share good step to read & understand the that concept...
Also performance issue in linux what are step & cmd can u tell me??? (2 Replies)
Hi All,
I am facing performance issue while rinning the LINUX shell script.
I have file1 and file 2. File one is the source file and file 2 is lookup file. Need to replace if the pattern is matching in file1 with file2.
The order of lookup file is important as if any match then exit... (8 Replies)
Hi,
I am beginner in shell scripting. I have written a script to parse file(s) having large number of lines each having multiple comma separated strings.
But it seems like script is very slow. It took more than 30mins to parse a file with size 120MB (523564 lines), below is the script code
... (4 Replies)
Discussion started by: imrandec85
4 Replies
LEARN ABOUT PHP
yaz_sort
YAZ_SORT(3) 1 YAZ_SORT(3)yaz_sort - Sets sorting criteriaSYNOPSIS
void yaz_sort (resource $id, string $criteria)
DESCRIPTION
This function sets sorting criteria and enables Z39.50 Sort.
Call this function beforeyaz_search(3). Using this function alone does not have any effect. When used in conjunction with yaz_search(3), a
Z39.50 Sort will be sent after a search response has been received and before any records are retrieved with Z39.50 Present
(yaz_present(3).
PARAMETERS
o $id
- The connection resource returned by yaz_connect(3).
o $criteria
- A string that takes the form field1 flags1 field2 flags2 where field1 specifies the primary attributes for sort, field2 seconds,
etc.. The field specifies either a numerical attribute combinations consisting of type=value pairs separated by comma (e.g.
1=4,2=1) ; or the field may specify a plain string criteria (e.g. title. The flags is a sequence of the following characters
which may not be separated by any white space.
Sort Flags
o a - Sort ascending
o d - Sort descending
o i - Case insensitive sorting
o s - Case sensitive sorting
RETURN VALUES
No value is returned.
EXAMPLES
Example #1
Sort Criterias
To sort on Bib1 attribute title, case insensitive, and ascending you would use the following sort criteria:
1=4 ia
If the secondary sorting criteria should be author, case sensitive and ascending you would use:
1=4 ia 1=1003 sa
PHP Documentation Group YAZ_SORT(3)