Efficient way to use yaz-client in a loop?
vfscalfani opened this issue · 2 comments
vfscalfani commented
Hi,
I'm trying to figure out the best way to run multiple queries (e.g., from a list) using yaz-client, and I'm wondering if you may be able to offer any tips. Here is where I am at:
Method 1:
I can create a file, mysearches, that looks something like this:
open library.ua.edu:7090/voyager
find @1=7 "1683925041"
sleep 1
find @1=7 "9780470183014"
sleep 1
find @1=7 "1565925858"
quit
and then use the -f
option:
yaz-client -f mysearches
The challenge with that approach is then I have to format the input file with find, sleep, etc.
Here is method 2, which I think is slightly easier:
for isbn in \
"1683925041" \
"9780470183014" \
"1565925858" \
"9780136778851" \
"1785284444"
do
printf "open library.ua.edu:7090/voyager\nfind @1=7 "$isbn"\nquit\n" |
yaz-client -f /dev/stdin
sleep 1
done
That's close to what I am looking for, but it seems not ideal to open and close the connection each time? Any ideas to improve method 2 or maybe I am missing a better option with yaz-client?
Thanks very much,
Vin
MikeTaylor commented
for isbn in \
1683925041 \
9780470183014 \
1565925858 \
9780136778851 \
1785284444
do
echo "open library.ua.edu:7090/voyager\nfind @1=7 "$isbn"\nsleep 1\n"
done | yaz-client -f /dev/stdin
…On Fri, Feb 3, 2023 at 10:50 PM Vincent F. Scalfani < ***@***.***> wrote:
Hi,
I'm trying to figure out the best way to run multiple queries (e.g., from
a list) using yaz-client, and I'm wondering if you may be able to offer any
tips. Here is where I am at:
Method 1:
I can create a file, mysearches, that looks something like this:
open library.ua.edu:7090/voyager
find @1=7 "1683925041"
sleep 1
find @1=7 "9780470183014"
sleep 1
find @1=7 "1565925858"
quit
and then use the -f option:
yaz-client -f mysearches
The challenge with that approach is then I have to format the input file
with find, sleep, etc.
Here is method 2, which I think is slightly easier:
for isbn in \
"1683925041" \
"9780470183014" \
"1565925858" \
"9780136778851" \
"1785284444"
do
printf "open library.ua.edu:7090/voyager\nfind <http://library.ua.edu:7090/voyager%5Cnfind> @1=7 "$isbn"\nquit\n" |
yaz-client -f /dev/stdin
sleep 1
done
That's close to what I am looking for, but it seems not ideal to open and
close the connection each time? Any ideas to improve method 2 or maybe I am
missing a better option with yaz-client?
Thanks very much,
Vin
—
Reply to this email directly, view it on GitHub
<#97>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABT6GI7HGSAA2UUQCLA2ETWVWDTNANCNFSM6AAAAAAUQYUXQU>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
vfscalfani commented
Hi @MikeTaylor. Thanks for this!