Hi,
Actually I have a file which consists data . for eg names.
Then I want my sql query to read this file and produce the output.
Currently I am using this
FOR EG : FILENAME is NAMES
for i in `cat NAMES`
{
sqlplus -s $CONNECTID << EOF
spool rooh
set heading off
select... (1 Reply)
Hi
I have around 100 users in sun server and have default home directory in /usr/home/<username>
I want to clean their home directory time to time to make free space on root, as users generate many output files during usage of application.
My idea is, generate a file with following command... (4 Replies)
I run into a issue when I try to do sorting of the following with ascending order, one round of for looping seems not working, anyone knows how to use shell or perl?
$array = (5,0,3,2,7,9,8) (2 Replies)
Hello, where can I get usefull information on the use of looping with for , if and while with extensive examples.
Also use of variables in scripts (1 Reply)
Hi,
Now I have written a script which sorts the records in the file and splits them according to some condition.
Now, I need to modify the script so that it reads all the files one after the other and does the sorting & splitting.
Pls help me in reading all the files in a directory and... (8 Replies)
Hi evryone
i need a help .
i have a file xcv.the content is :
accelerate
i want a script which will run 1000 times in loop and changing the value to
accelerate to
acceler
in 1st loop and in 2nd loop it will be again
accelerate and so on . (6 Replies)
so when i use rm file -i vv bb i can delete the first file vv but i cant seem to delete the second file bb as i tried to use shift on it, but it seems that it delete the first one and stops it without looping it to the next file. what is wrong with my coding ?
#!/bin/bash
function... (3 Replies)
Hey guys, so I am trying to do a loop script that will go through each folder (no gui so just each domain has a folder) and grab out the databases being used on that domain. I know I would use
mysql -e "show databases where not 'information_schema';" once in each directory to pull the actual... (3 Replies)
My script will do:
while true
do
if ]; then
### here im mailing content of file.txt
fi
if ]; then
exit 0
fi
sleep 30m
done
If i add exit 1 after ### mail, script is getting stopped.
Can you please suggest, how to implement above requirement. Mine is Linux machine. (11 Replies)
Discussion started by: JSKOBS
11 Replies
LEARN ABOUT NETBSD
getline
GETDELIM(3) BSD Library Functions Manual GETDELIM(3)NAME
getdelim, getline -- read a delimited record from a stream
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <stdio.h>
ssize_t
getdelim(char ** restrict lineptr, size_t * restrict n, int delimiter, FILE * restrict stream);
ssize_t
getline(char ** restrict lineptr, size_t * restrict n, FILE * restrict stream);
DESCRIPTION
The getdelim() function reads from the stream until it encounters a character matching delimiter, storing the input in *lineptr. The buffer
is NUL-terminated and includes the delimiter. The delimiter character must be representable as an unsigned char.
If *n is non-zero, then *lineptr must be pre-allocated to at least *n bytes. The buffer should be allocated dynamically; it must be possible
to free(3) *lineptr. getdelim() ensures that *lineptr is large enough to hold the input, updating *n to reflect the new size.
The getline() function is equivalent to getdelim() with delimiter set to the newline character.
RETURN VALUES
The getdelim() and getline() functions return the number of characters read, including the delimiter. If no characters were read and the
stream is at end-of-file, the functions return -1. If an error occurs, the functions return -1 and the global variable errno is set to indi-
cate the error.
The functions do not distinguish between end-of-file and error, and callers must use feof(3) and ferror(3) to determine which occurred.
EXAMPLES
The following code fragment reads lines from a file and writes them to standard output.
char *line = NULL;
size_t linesize = 0;
ssize_t linelen;
while ((linelen = getline(&line, &linesize, fp)) != -1)
fwrite(line, linelen, 1, stdout);
if (ferror(fp))
perror("getline");
ERRORS
[EINVAL] lineptr or n is a NULL pointer.
[EOVERFLOW] More than SSIZE_MAX characters were read without encountering the delimiter.
The getdelim() and getline() functions may also fail and set errno for any of the errors specified in the routines fflush(3), malloc(3),
read(2), stat(2), or realloc(3).
SEE ALSO ferror(3), fgets(3), fopen(3)STANDARDS
The getdelim() and getline() functions conform to IEEE Std 1003.1-2008 (``POSIX.1'').
BSD June 30, 2010 BSD