Hi there,
I want some help on scripting regarding file processing.
I have a scenario in which I have 10 files. (file1.txt, file2.txt....) and they are in paricular format.
I want to read these files and append some text lines at the begining of each file and write this updated contents of... (2 Replies)
Hi
I have a tab delimited file with 3 fields. I need to sort this file on the first field and remove all the records where the first field has dulplicates. For eg my file is
133|arrfdfdg|sdfdsg
234|asfsdgfs|aasdfs
133|affbfsde|dgfg
When this file gets sorted I need the result to be ... (2 Replies)
Hi
I have a shared object which is called from a third party tool.
In my .so, I am using 'freopen(mylogfilename,"at",stderr)'. It is logging all my program output and it is also writing warning messages from the third party daemons also.
How can I avoid these unwanted messages... (1 Reply)
Hi!
I'm looking for a command/script to be able to get the program who write into a file.
I've a logfile who grow up but I don't find which program write on it :eek:
thanks for your support&help.
.fr. (2 Replies)
Hi,
Iam having the two files as follows:
file1:
ASQWEDFR09876543121234512
POIUYTREW09876512345676788
ZXCVBNMKS1209888888888888
file2:
ASQWEDFR09876543121234516 asdcvfgbtg@abc.com 0000000-90-1239--2008 8990----
CXADFGTU09876543121234789 asdcvfgbtg@abc.com ... (14 Replies)
hi,
I am writing one packet receiving program using libpcap library.
Now, I want to check port is already using or not.
how to check in receiver program..
If normal program,using bind return value we can able to check the port is already using or not.
but, in pcap program how can i... (1 Reply)
Hello all,
I am looking for a solution to the following problem. Perl or python solutions also welcome.
Given this input:
And this input:
I want to get this output.
The rule being that if the number in the first file is < 0.9, then the corresponding two columns on... (2 Replies)
Hi ,
I have a file myhost.txt which contains below,
127.0.0.1 localhost
1.17.1.5 atrpx958
11.17.10.11 atrpx958zone nsybhost
I need to append words only after "atrpx958" like 'myhost' and 'libhost' and not after atrpx958zone.
How to search the word atrpx958(which is hostname) only,... (5 Replies)
Hi all,
i need to do a piecewise integration between this example data inside a file :
500856704.00 11536282.5600897 50496
500402784.00 11538000.3654401 -453920
500654880.00 11538000.4662785 252096
500604416.00 11539718.4330113 -50464
500907168.00 11539718.5541121 302752
500705280.00... (3 Replies)
Hi Folks,
Below is example of an Input data which is used, based on the last 2, 3 & 4 column, I want my first column data to be collated as shown in the output section.
a,ac,tc,ic
b,ac,tc,ic
c,ac,tc,ic
d,ac,tc,ic
b,bc,tc,ic
d,bc,tc,ic
e,bc,tc,ic
I want my output to be
... (2 Replies)
Discussion started by: nikhil jain
2 Replies
LEARN ABOUT BSD
setbuffer
SETBUF(3S)SETBUF(3S)NAME
setbuf, setbuffer, setlinebuf - assign buffering to a stream
SYNOPSIS
#include <stdio.h>
setbuf(stream, buf)
FILE *stream;
char *buf;
setbuffer(stream, buf, size)
FILE *stream;
char *buf;
int size;
setlinebuf(stream)
FILE *stream;
DESCRIPTION
The three types of buffering available are unbuffered, block buffered, and line buffered. When an output stream is unbuffered, information
appears on the destination file or terminal as soon as written; when it is block buffered many characters are saved up and written as a
block; when it is line buffered characters are saved up until a newline is encountered or input is read from stdin. Fflush (see
fclose(3S)) may be used to force the block out early. Normally all files are block buffered. A buffer is obtained from malloc(3) upon the
first getc or putc(3S) on the file. If the standard stream stdout refers to a terminal it is line buffered. The standard stream stderr is
always unbuffered.
Setbuf is used after a stream has been opened but before it is read or written. The character array buf is used instead of an automati-
cally allocated buffer. If buf is the constant pointer NULL, input/output will be completely unbuffered. A manifest constant BUFSIZ tells
how big an array is needed:
char buf[BUFSIZ];
Setbuffer, an alternate form of setbuf, is used after a stream has been opened but before it is read or written. The character array buf
whose size is determined by the size argument is used instead of an automatically allocated buffer. If buf is the constant pointer NULL,
input/output will be completely unbuffered.
Setlinebuf is used to change stdout or stderr from block buffered or unbuffered to line buffered. Unlike setbuf and setbuffer it can be
used at any time that the file descriptor is active.
A file can be changed from unbuffered or line buffered to block buffered by using freopen (see fopen(3S)). A file can be changed from
block buffered or line buffered to unbuffered by using freopen followed by setbuf with a buffer argument of NULL.
SEE ALSO fopen(3S), getc(3S), putc(3S), malloc(3), fclose(3S), puts(3S), printf(3S), fread(3S)BUGS
The standard error stream should be line buffered by default.
The setbuffer and setlinebuf functions are not portable to non-4.2BSD versions of UNIX. On 4.2BSD and 4.3BSD systems, setbuf always uses a
suboptimal buffer size and should be avoided. Setbuffer is not usually needed as the default file I/O buffer sizes are optimal.
4th Berkeley Distribution May 12, 1986 SETBUF(3S)