09-21-2015
It doesn't look like it's the loop that's the problem, to me. It's the creation of all those tiny files, and all those external tr -d calls, and the >> re-opening the same file over and over and over.
This User Gave Thanks to Corona688 For This Post:
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Good morning - I have publication lists from 34 different faculty members. I need to end up with the numbers of publications in common across all 34 faculty.
I need to grep person1 (last name) in list2, person1 in list3, person1 in list 4, etc., then person2 in list3, person 2 in list4, etc.,... (2 Replies)
Discussion started by: Peggy White
2 Replies
2. Shell Programming and Scripting
I need help getting over this bump on how nested for loops work in shell. Say i was comparing files in a directory in any other language my for loop would look like so
for(int i=0;to then end; i++)
for(int y = i+1; to the end; y++)
I can't seem to understand how i can translate that... (5 Replies)
Discussion started by: taiL
5 Replies
3. Shell Programming and Scripting
Hello All,
I have another Korn shell question. I am writing a script that will ftp a file from my production database to my test database.
To this, I have to construct a loop that checks a specified folder for a file.
If the file exists, I want it execute the ftp protocol and then exit. ... (2 Replies)
Discussion started by: jonesdk5
2 Replies
4. Shell Programming and Scripting
You can use one while inside another?
I made the following script (without really knowing if I can use two while) to get 3 numbers different from each other at random:
num1=$(( $RANDOM % 10 ))
num2=$num1
while
do
num2=$(( $RANDOM % 10 ))
done
num3=$num1
while
do
while
do... (1 Reply)
Discussion started by: ale.dle
1 Replies
5. Shell Programming and Scripting
KSH isn't my strong suit but it's what my company has to offer. I've got a script with two nested loops, a FOR and UNTIL, and that works fine. When I add a CASE into the mix I end up getting "Unexpected 'done' at line xx" errors. Any suggestions on this?
for divi in at ce ci cm co de di fl... (9 Replies)
Discussion started by: mrice
9 Replies
6. UNIX for Dummies Questions & Answers
Hi experts,
I just want to know if there is a better solution to my nested while read loops below:
while read line; do
while read line2; do
while read line3; do
echo "$line $line2 $line3"
done < file3.txt
done < file2.txt
done < file1.txt >... (4 Replies)
Discussion started by: chstr_14
4 Replies
7. Shell Programming and Scripting
Greetings All,
The following script attempts to enumerate all users in all groups in the group file(GROUP) and echo the following information:
GROUP ---> USER
The script is as follows:
IFS=","
for GROUP in `ypcat -k group | cut -d" " -f1`
do
for USER in `ypcat -k group... (13 Replies)
Discussion started by: jacksolm
13 Replies
8. UNIX for Dummies Questions & Answers
It's been a while since I used csh formatting and I am having a little bit of trouble with a few things. Things seem so much easier to execute in Matlab, however I need to do this on the terminal because of the programs I am trying to interact with.
So here's what I want to do: I have a file... (0 Replies)
Discussion started by: katia
0 Replies
9. Shell Programming and Scripting
for server in $(echo `cat /tmp/ScanHosts_${USERSNAME}.TXT`)
do
for portnumber in $(echo `cat /tmp/ScanPorts_${USERSNAME}.TXT`)
do
#echo ${server} ${portnumber}
... (3 Replies)
Discussion started by: SkySmart
3 Replies
LEARN ABOUT DEBIAN
xpamainloop
xpamainloop(3) SAORD Documentation xpamainloop(3)
NAME
XPAMainLoop - optional main loop for XPA
SYNOPSIS
#include <xpa.h>
void XPAMainLoop();
DESCRIPTION
Once XPA access points have been defined, a program must enter an event loop to watch for requests from external programs. This can be done
in a variety of ways, depending on whether the event loop is processing events other than XPA events. In cases where there are no non-XPA
events to be processed, the program can simply call the XPAMainLoop() event loop. This loop is implemented essentially as follows (error
checking is simplified in this example):
FD_ZERO(&readfds);
while( XPAAddSelect(NULL, &readfds) ){
if( sgot = select(swidth, &readfds, NULL, NULL, NULL) >0 )
XPAProcessSelect(&readfds, 0);
else
break;
FD_ZERO(&readfds);
}
The XPAAddSelect() routine sets up the select() readfds variable so that select() will wait for I/O on all the active XPA channels. It
returns the number of XPAs that are active; the loop will end when there are no active XPAs. The standard select() routine is called to
wait for an external I/O request. Since no timeout struct is passed in argument 5, the select() call hangs until there is an external
request. When an external I/O request is made, the XPAProcessSelect() routine is executed to process the pending requests. In this rou-
tine, the maxreq value determines how many requests will be processed: if maxreq <=0, then all currently pending requests will be pro-
cessed. Otherwise, up to maxreq requests will be processed. (The most usual values for maxreq is 0 to process all requests.)
If a program has its own Unix select() loop, then XPA access points can be added to it by using a variation of the standard XPAMainLoop:
XPAAddSelect(xpa, &readfds);
[app-specific ...]
if( select(width, &readfds, ...) ){
XPAProcessSelect(&readfds, maxreq);
[app-specific ...]
FD_ZERO(&readfds);
}
XPAAddSelect() is called before select() to add the access points. If the first argument is NULL, then all active XPA access points are
added. Otherwise only the specified access point is added. After select() is called, the XPAProcessSelect() routine can be called to
process XPA requests. Once again, the maxreq value determines how many requests will be processed: if maxreq <=0, then all currently pend-
ing requests will be processed. Otherwise, up to maxreq requests will be processed.
XPA access points can be added to Xt event loops (using XtAppMainLoop()) and Tcl/Tk event loops (using vwait and the Tk loop). When using
XPA with these event loops, you only need to call:
int XPAXtAddInput(XtAppContext app, XPA xpa)
or
int XPATclAddInput(XPA xpa)
respectively before entering the loop.
SEE ALSO
See xpa(7) for a list of XPA help pages
version 2.1.14 June 7, 2012 xpamainloop(3)