Hi,
I want to write a shell script which increments a particular column in a row from a text file and then adds another row below the current row with the incremented value .
For Eg .
if the input file has a row :
abc xyz lmn 89 lm nk o p
I would like the script to create something like... (9 Replies)
Hi there,
I've an input file1 as follows:
1001
1002
1003
1004
1005
I would like to have an output file2 as follows:
Numbers are 1001/ 1002/ 1003/ 1004/ 1005/
Any help is appreciated. (2 Replies)
Hello,
I have an input file like the following:
11_3_4
2_1_35
3_15__
_16989
Where '_' is a space. The data is in a table. Is there a way for the program to prompt the user for x1,y1 and x2,y2, where x1,y1 is the desired number (for example x=6 y=4 is a value of 4) and move to a desired spot... (2 Replies)
Hi Forum.
I searched the forum for a solution but could not find an exact one to my problem.
I have some records in the file where I would like to convert the last date field to another format while preserving the rest of the other fields.
For example:
Found:... (6 Replies)
I have a file containing rows with the following format.
Field1|Field2|Field3|data1:data data2:data data3:"dataA:data dataB:data" data4:data:data (and so on)
I need to format the above row into multiple rows that look like this:
Field1|Field2|Field3|data1|data
... (2 Replies)
Hi Friends,
I have a single column data like below.
1
2
3
4
5
I need the output like below.
0
1
2
3
4
where each row (including first row) subtracting from first row and the result should print below like the way shown in output file.
Thanks
Sid (11 Replies)
Hi Unix Forum,
I have a relatively easy question i suppose for which, however, until now i could not find a solution.
I am working with a program that will give me an output file similar to the following:
A
1
2
3
4
B
1
2
3
4
C
1 (9 Replies)
I have a table with this structure:
cola colb colc
1 19 lemon
20 31 lemon
32 100 lemon
159 205 cherries
210 500 cherries
and need to parse it into this format:
cola colb colc
1 100 lemon
159 500 cherries
So I need the first row of cola and the last row of colb if colc has the... (3 Replies)
Discussion started by: coppuca
3 Replies
LEARN ABOUT OPENSOLARIS
flockfile
flockfile(3C) Standard C Library Functions flockfile(3C)NAME
flockfile, funlockfile, ftrylockfile - acquire and release stream lock
SYNOPSIS
#include <stdio.h>
void flockfile(FILE *stream);
void funlockfile(FILE *stream);
int ftrylockfile(FILE *stream);
DESCRIPTION
The flockfile() function acquires an internal lock of a stream stream. If the lock is already acquired by another thread, the thread call-
ing flockfile() is suspended until it can acquire the lock. In the case that the stream lock is available, flockfile() not only acquires
the lock, but keeps track of the number of times it is being called by the current thread. This implies that the stream lock can be
acquired more than once by the same thread.
The funlockfile() function releases the lock being held by the current thread. In the case of recursive locking, this function must be
called the same number of times flockfile() was called. After the number of funlockfile() calls is equal to the number of flockfile()
calls, the stream lock is available for other threads to acquire.
The ftrylockfile() function acquires an internal lock of a stream stream, only if that object is available. In essence ftrylockfile() is a
non-blocking version of flockfile().
RETURN VALUES
The ftrylockfile() function returns 0 on success and non-zero to indicate a lock cannot be acquired.
EXAMPLES
Example 1 A sample program of flockfile().
The following example prints everything out together, blocking other threads that might want to write to the same file between calls to
fprintf(3C):
FILE iop;
flockfile(iop);
fprintf(iop, "hello ");
fprintf(iop, "world);
fputc(iop, 'a');
funlockfile(iop);
An unlocked interface is available in case performance is an issue. For example:
flockfile(iop);
while (!feof(iop)) {
*c++ = getc_unlocked(iop);
}
funlockfile(iop);
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO Intro(3), __fsetlocking(3C), ferror(3C), fprintf(3C), getc(3C), putc(3C), stdio(3C), ungetc(3C), attributes(5), standards(5)NOTES
The interfaces on this page are as specified in IEEE Std 1003.1:2001. See standards(5).
SunOS 5.11 10 Sep 2003 flockfile(3C)