10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
I have if loop with multiple variable value check in if loop. How can i print only if loop satisfied variable and its value in shell script ? I dont want to check each variable in if loop. That makes my script larger.
if ]
then
echo "Only satisfied variable with value"
... (3 Replies)
Discussion started by: prince1987
3 Replies
2. UNIX for Beginners Questions & Answers
hi,
I am using hp unix server and not getting variable output present inside the while loop. I have tried changing the code and need to verify whether it is proper practice of code. I am expecting the output of varible RUN_FILE 3 to TRUE which i get inside the while loop.
RUN_FILE 1=TRUE... (8 Replies)
Discussion started by: gowthamsoft
8 Replies
3. Shell Programming and Scripting
Hi
i have a 2 files say test1 and test2 with the following data.
cat file
test
test1
i want to append the output from a awk one liner to both the files.
for i in cat file;do awk '/
whats happening is its printing the output properly. but not appending the way it showing in print... (1 Reply)
Discussion started by: venkitesh
1 Replies
4. Shell Programming and Scripting
consider the script below
sh /opt/hqe/hqapi1-client-5.0.0/bin/hqapi.sh alert list --host=localhost --port=7443 --user=hqadmin --password=hqadmin --secure=true >/tmp/alerts.xml
awk -F'' '{for(i=1;i<=NF;i++){
if($i=="Alert id") {
if(id!="")
if(dt!=""){
cmd="sh someScript.sh... (2 Replies)
Discussion started by: vivek d r
2 Replies
5. Shell Programming and Scripting
Hello experts,
I'm stuck with this script for three days now. Here's what i need.
I need to split a large delimited (,) file into 2 files based on the value present in the last field.
Samp: Something.csv
bca,adc,asdf,123,12C
bca,adc,asdf,123,13C
def,adc,asdf,123,12A
I need this split... (6 Replies)
Discussion started by: shell_boy23
6 Replies
6. Shell Programming and Scripting
cs1=`echo "scale=8;($css1/$css0)*100"|bc`
cs2=`echo "scale=8;($css2/$css0)*100"|bc`
cs3=`echo "scale=8;($css3/$css0)*100"|bc`
cs4=`echo "scale=8;($css4/$css0)*100"|bc`
cs5=`echo "scale=8;($css5/$css0)*100"|bc`
cs6=`echo "scale=8;($css6/$css0)*100"|bc`
cs7=`echo "scale=8;($css7/$css0)*100"|bc`... (3 Replies)
Discussion started by: thulasidharan2k
3 Replies
7. Shell Programming and Scripting
Hi,
awk -F"|" 'BEGIN{sum=0}{sum+=$2}END{printf("%d\n", sum)}' css.txt
awk -F"|" 'BEGIN{sum=0}{sum+=$3}END{printf("%d\n", sum)}' css.txt
awk -F"|" 'BEGIN{sum=0}{sum+=$4}END{printf("%d\n", sum)}' css.txt
awk -F"|" 'BEGIN{sum=0}{sum+=$5}END{printf("%d\n", sum)}' css.txt
awk -F"|"... (3 Replies)
Discussion started by: thulasidharan2k
3 Replies
8. Shell Programming and Scripting
Hi all
I run my program prog.c in the following way :
$ ./prog 1 > output.txt where 1 is a user defined initial value used by the program.
But now I want to run it for many a thousand initial values, 1-1000, and store all the outputs in different files.
Like
$ ./prog 1... (1 Reply)
Discussion started by: alice06
1 Replies
9. Shell Programming and Scripting
hi all,
i am experiencing an error which i think an incorrect syntax for the where clause passing a variable was given. under is my code.
sqlplus -s ${USERNAME}/${PASSWORD}@${SID} << END1 >> $LOGFILE
whenever sqlerror exit
set serveroutput on size 1000000
declare
l_rc ... (0 Replies)
Discussion started by: ryukishin_17
0 Replies
10. Shell Programming and Scripting
Hi Gurus
I have a file called /tmp/CMDB which looks like this
serial: 0623AN1208
hostname: server1
model: x4100
assetID: 1234
I am writing a for loop that will go through this file line by line creating a variable of itself. Using the first iteration of the loop (i.e. the first line) as... (6 Replies)
Discussion started by: hcclnoodles
6 Replies
PCAP_BREAKLOOP(3PCAP) PCAP_BREAKLOOP(3PCAP)
NAME
pcap_breakloop - force a pcap_dispatch() or pcap_loop() call to return
SYNOPSIS
#include <pcap/pcap.h>
void pcap_breakloop(pcap_t *);
DESCRIPTION
pcap_breakloop() sets a flag that will force pcap_dispatch() or pcap_loop() to return rather than looping; they will return the number of
packets that have been processed so far, or -2 if no packets have been processed so far.
This routine is safe to use inside a signal handler on UNIX or a console control handler on Windows, as it merely sets a flag that is
checked within the loop.
The flag is checked in loops reading packets from the OS - a signal by itself will not necessarily terminate those loops - as well as in
loops processing a set of packets returned by the OS. Note that if you are catching signals on UNIX systems that support restarting system
calls after a signal, and calling pcap_breakloop() in the signal handler, you must specify, when catching those signals, that system calls
should NOT be restarted by that signal. Otherwise, if the signal interrupted a call reading packets in a live capture, when your signal
handler returns after calling pcap_breakloop(), the call will be restarted, and the loop will not terminate until more packets arrive and
the call completes.
Note also that, in a multi-threaded application, if one thread is blocked in pcap_dispatch(), pcap_loop(), pcap_next(), or pcap_next_ex(),
a call to pcap_breakloop() in a different thread will not unblock that thread; you will need to use whatever mechanism the OS provides for
breaking a thread out of blocking calls in order to unblock the thread, such as thread cancellation in systems that support POSIX threads.
Note that pcap_next() and pcap_next_ex() will, on some platforms, loop reading packets from the OS; that loop will not necessarily be ter-
minated by a signal, so pcap_breakloop() should be used to terminate packet processing even if pcap_next() or pcap_next_ex() is being used.
pcap_breakloop() does not guarantee that no further packets will be processed by pcap_dispatch() or pcap_loop() after it is called; at most
one more packet might be processed.
If -2 is returned from pcap_dispatch() or pcap_loop(), the flag is cleared, so a subsequent call will resume reading packets. If a posi-
tive number is returned, the flag is not cleared, so a subsequent call will return -2 and clear the flag.
SEE ALSO
pcap(3PCAP), pcap_loop(3PCAP), pcap_next_ex(3PCAP)
5 April 2008 PCAP_BREAKLOOP(3PCAP)