I need some help with this code below, i doesnt know why it will run twice with my function, but my function only got if else, any other way that can read line and put into array?
Just want to learn how these are read into array but I don't seem to get it right what do I go wrong?
Below is the sample
Thanks
input
1 2 3 4
5 6 7 8
9 1 2 3
4 5 6 7
#!/usr/bin/perl
open (InFILE,"input");
while (<InFILE>) {
@ar = split ; (5 Replies)
Hi All,
I am having trouble through, I am reading the input from tab delimited file containing several records,
e.g.
line1 field1 field2 field3 so on..
line2 field1 field2 field3 so on..
..
..
on the basis of certain fields for each record in input file, I have to retrieve... (1 Reply)
I have a file that is a text file, how to get all the words into and array, i am able to get each line but not each word :(.
Here is what i searched and already found...https://www.unix.com/shell-programming-scripting/99207-pipe-text-file-into-array.html.
This one reads a whole line into... (6 Replies)
Hello,
i have a file "Movie.ini" looking e.g. like follows
* MOVIE A
bla bla
MOVIE B
blubb blubb
MOVIE C
I'd like to read the file "Movie.ini" with cat and grep and check whether it includes the string MOVIE only with a '*' at the beginnig.
By doing
"cat Movie.ini| grep MOVIE... (14 Replies)
Hi,
I am trying to read a set of numbers that are in scientific notation into a file so I can do some math on them, but when I display the array contents the numbers aren't the same as the numbers in the file.
Could someone explain why? Thanks.
int main()
{
double fArray;
... (3 Replies)
I wrote a simply perl that searched a file for a particualr value and if it found it, rite it and the next three lines to a file. Now I have been asked to check those next three lines for a different value and only write those lines if it finds the second value.
I was thinking the best way to... (1 Reply)
Hi,
I am not so familiar with bash scripting and would appreciate your help here.
I have a text file 'input.txt' like this:
2 3 4
5 6 7
8 9 10
I want to store each column in an array like this
a ={2 5 8}, b={3 6 9}, c={4 7 10}
so that i can access any element, e.g b=6 for the later use. (1 Reply)
Hi,
I need to read a file into array and print them in a loop:-
1st file :-cat a.txt
RC1
RC2
RC3
RC4
My Program:-
#!/bin/ksh
index=0
while
do
read cnt<a.txt
print "cnt value is ${cnt}
index=`expr $index + 1`
done
Code tags for code, please. (5 Replies)
Hi I have a file with contents as below :
server | ABC Issue : File System Missing XYZ Issue : Wrong Syntax PQR Issue : Old File to be removed
Now I am looking for an o/p similar to
server <tab> ABC Issue : File System Missing
<tab> XYZ Issue : Wrong Syntax
<tab>... (4 Replies)
Hello,
I am running under ubuntu1 14.04 and I have a script which is sending given process names to vanish so that I'd see less output when I run most popular tools like top etc in terminal window. In usual method it works.
Whenever I restart the system, I have to enter the same data from... (2 Replies)
Discussion started by: baris35
2 Replies
LEARN ABOUT OPENSOLARIS
qreply
qreply(9F) Kernel Functions for Drivers qreply(9F)NAME
qreply - send a message on a stream in the reverse direction
SYNOPSIS
#include <sys/stream.h>
void qreply(queue_t *q, mblk_t *mp);
INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI).
PARAMETERS
q Pointer to the queue.
mp Pointer to the message to be sent in the opposite direction.
DESCRIPTION
The qreply() function sends messages in the reverse direction of normal flow. That is, qreply(q, mp) is equivalent to putnext(OTHERQ(q),
mp).
CONTEXT
The qreply() function can be called from user, interrupt, or kernel context.
EXAMPLES
Example 1 Canonical Flushing Code for STREAMS Drivers.
This example depicts the canonical flushing code for STREAMS drivers. Assume that the driver has service procedures so that there may be
messages on its queues. See srv(9E). Its write-side put procedure handles M_FLUSH messages by first checking the FLUSHW bit in the first
byte of the message, then the write queue is flushed (line 8) and the FLUSHW bit is turned off (line 9). See put(9E). If the FLUSHR bit is
on, then the read queue is flushed (line 12) and the message is sent back up the read side of the stream with the qreply() function (line
13). If the FLUSHR bit is off, then the message is freed (line 15). See the example for flushq(9F) for the canonical flushing code for mod-
ules.
1 xxxwput(q, mp)
2 queue_t *q;
3 mblk_t *mp;
4 {
5 switch(mp->b_datap->db_type) {
6 case M_FLUSH:
7 if (*mp->b_rptr & FLUSHW) {
8 flushq(q, FLUSHALL);
9 *mp->b_rptr &= ~FLUSHW;
10 }
11 if (*mp->b_rptr & FLUSHR) {
12 flushq(RD(q), FLUSHALL);
13 qreply(q, mp);
14 } else {
15 freemsg(mp);
16 }
17 break;
. . .
18 }
19 }
SEE ALSO put(9E), srv(9E), flushq(9F), OTHERQ(9F), putnext(9F)
Writing Device Drivers
STREAMS Programming Guide
SunOS 5.11 16 Jan 2006 qreply(9F)