Sponsored Content
Top Forums Programming Forcing a write to a file without newline? Post 302925165 by madd-games on Friday 14th of November 2014 10:38:35 AM
Old 11-14-2014
Simply flushing stdout will not do anything, because when I execute bash, I also need its output automatically flushed. Would setbuf(stdout, NULL) cause bash not to buffer the output?
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

forcing su on a user

This is for 3 os's, AIX, Solaris, and AIX, didnt want to post three seperate times on the same subject, anyways, I want to force the user MQM to su, i.e. not be able to rlogin/telnet to the box as user MQM, only login as there ID(chris for example) and su to MQM, does anyone know how to do this,... (4 Replies)
Discussion started by: csaunders
4 Replies

2. Solaris

forcing users to su

Is there a way in solaris 9 to prevent a user to login via ssh, telnet, rlogin, and only be able to su as that user, for example have DBA joe blow login as jblow, and then su to oracle BUT not vice versa have DBA joe blow login as oralce (6 Replies)
Discussion started by: csaunders
6 Replies

3. Shell Programming and Scripting

Append newline at the file end

Hi All, Is there any way to append a newline character at the end of a file(coma-separated file), through shell script? I need to check whether newline character exists at the end of a file, if it does not then append it. Regards, Krishna (1 Reply)
Discussion started by: KrishnaSaran
1 Replies

4. Shell Programming and Scripting

SED to convert ~ in a file to newline

Hi, I have a .txt file which has a tilde(~) in it. All that I want is to break into a newline whenever there is an occurence of '~'. I have tried SED to do that but I could not succeed. I would appreciate if I can get a shell script(ksh) for this problem real quick. Thanks in advance. ... (5 Replies)
Discussion started by: ntekupal
5 Replies

5. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

6. UNIX for Dummies Questions & Answers

Match EOF on newline in a file

Hi, i have a file where the end-of-file might be at the end of of a valid text line or on a new line case a) p q r s t u <eof> case b) p q r s t u <eof> case c) p q r s t u <no data, only carriage return> <eof> I have a requirement where <eof> line should not be read if it's... (3 Replies)
Discussion started by: ysrini
3 Replies

7. Shell Programming and Scripting

How to check newline character in file?

Hi All, I have file with only one record,always be only one record. as like below. if that line contains newline end of the line..no need to add, if not just add the new line character. END OF FILE. ROW COUNT: 7 Please help me.. Thanks, (9 Replies)
Discussion started by: bmk
9 Replies

8. Shell Programming and Scripting

Newline characters in fields of a file

My source file is pipe delimeted file with 53 fields.In 33 rd column i am getting mutlple new line characters,dule to that record is breaking into multiple records. Note : here record delimter also \n sample Source file with 6 fields : 1234|abc| \nabcd \n bvd \n cde \n |678|890|900\n ... (6 Replies)
Discussion started by: lakshmi001
6 Replies

9. Shell Programming and Scripting

Newline in the file

I have requirement to remove the /n ( newline ) characters from the file. When I open file in VI .. I want to see newline char how to display newline char .. or where can I see the content with newline char visible? (3 Replies)
Discussion started by: freakabhi
3 Replies

10. Shell Programming and Scripting

No newline at end of file

Hello all, I have maybe a simple Problem - but I do not know to handle it. All what I want, is to write a line to file without a newline at the end. It works with "echo -n" for all lines, but not for the last one. At the end of the file is always a "0a" (hex) My small script: ... (10 Replies)
Discussion started by: API
10 Replies
setbuf(3S)																setbuf(3S)

NAME
setbuf(), setvbuf(), setlinebuf() - assign buffering to a stream file SYNOPSIS
Obsolescent Interface DESCRIPTION
can be used after a stream has been opened but before it is read or written. It causes the array pointed to by buf to be used instead of an automatically allocated buffer. If buf is the NULL pointer input/output will be completely unbuffered. A constant defined in the header file, tells how big an array is needed: can be used after a stream has been opened but before it is read or written. type determines how stream is to be buffered. Legal values for type (defined in are: causes input/output to be fully buffered. causes output to be line buffered; the buffer will be flushed when a newline is written, the buffer is full, or input is requested. causes input/output to be completely unbuffered. When an output stream is unbuffered, information is queued for writing on the destination file or terminal as soon as written; when it is buffered, many characters are saved up and written as a block. When the output stream is line-buffered, each line of output is queued for writing on the destination terminal as soon as the line is completed (that is, as soon as a new-line character is written or terminal input is requested). can also be used to explicitly write the buffer. If buf is not the NULL pointer, the array it points to is used for buffering instead of an automatically allocated buffer (from size speci- fies the size of the buffer to be used. The constant in is suggested as a good buffer size. If input/output is unbuffered, buf and size are ignored. By default, output to a terminal is line buffered and all other input/output is fully buffered. is used to change stream from block-buffered or unbuffered to line-buffered. can be used any time the file descriptor is active. Obsolescent Interface assigns buffering to a stream file. DIAGNOSTICS
If an illegal value for type or size is provided, return a non-zero value. Otherwise, the value returned will be zero. Note A common source of error is allocating buffer space as an "automatic" variable in a code block, then failing to close the stream in the same block. Allocating a buffer of size or bytes does not necessarily imply that all of size or bytes are used for the buffer area. AUTHOR
and were developed by HP. SEE ALSO
flockfile(3S), fopen(3S), getc(3S), malloc(3C), putc(3S), stdio(3S), thread_safety(5), glossary(9). STANDARDS CONFORMANCE
setbuf(3S)
All times are GMT -4. The time now is 10:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy