Hi all,
I'm looking for some help. I have a file (very long) that is organized like below:
>Cluster 0
0 283nt, >01_FRYJ6ZM12HMXZS... at +/99%
1 279nt, >01_FRYJ6ZM12HN12A... at +/99%
2 281nt, >01_FRYJ6ZM12HM4TS... at +/99%
3 283nt, >01_FRYJ6ZM12HM946... at +/99%
4 279nt,... (4 Replies)
Hi,
I am trying to locate the occurences of certain pattern like 'Possible network disconnect' in a text file. I can get the actual lines matching the pttern using:
grep -w 'Possible network disconnect' file_name.
But I am more interested in getting the timing of these events which are... (7 Replies)
Hi,
I have a requirement to to an ldapsearch and remove the shadow attributes in the output file.
What I do is ldapsearch() | operation to remove shadow > FILE
The ldapsearch gives output like this(with same line formation):
objectClass: FSConfig
objectClass: extensibleObject
fsCAIP:... (10 Replies)
Hi ,
I have a file which has multiple rows of data, i want to match the pattern for two columns and if both conditions satisfied i have to add the counter by 1 and finally print the count value. How to proceed...
I tried in this way...
awk -F, 'BEGIN {cnt = 0} {if $6 == "VLY278" &&... (6 Replies)
Hi, i need help with my shell script
I have a file input.txt containing the following contents
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/wine
/usr/share/doc/wine/copyright
/usr/share/doc/wine/changelog.Debian.gz
I need output as
/usr/share/doc/wine
/usr/share/doc/wine/copyright... (3 Replies)
'Hi
I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match.
Which option is to be used to exclude the line containing the pattern?
sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
hi
I have a large xml file from which i have taken few lines . In this file I have to find for the string </invoices> and check if the 3 rd line after this string does not begin with <portCode> ,then i have to delete the string </invoices> and the next line having the string </shippingBill>... (13 Replies)
Hi all!
Thanks for taking the time to view this!
I want to grep out all lines of a file that starts with pattern 1 but also does not match with the second pattern.
Example:
Drink a soda
Eat a banana
Eat multiple bananas
Drink an apple juice
Eat an apple
Eat multiple apples
I... (8 Replies)
GM,
I have an issue at work, which requires a simple solution. But, after multiple attempts, I have not been able to hit on the code needed.
I am assuming that sed, awk or even perl could do what I need.
I have an application that adds extra blank page feeds, for multiple reports, when... (7 Replies)
Hi Guys,
I am trying to format my csv file. When I spool the file using sqlplus the single row output is wrapped on three lines.
Somehow I managed to format that file and finally i am trying to make the multiple line on single line.
The below command is working fine but I need to pass the... (3 Replies)
Discussion started by: RJSKR28
3 Replies
LEARN ABOUT REDHAT
getdelim
GETLINE(3) Linux Programmer's Manual GETLINE(3)NAME
getline, getdelim - delimited string input
SYNOPSIS
#define _GNU_SOURCE
#include <stdio.h>
ssize_t getline(char **lineptr, size_t *n, FILE *stream);
ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream);
DESCRIPTION
getline() reads an entire line, storing the address of the buffer containing the text into *lineptr. The buffer is null-terminated and
includes the newline character, if a newline delimiter was found.
If *lineptr is NULL, the getline() routine will allocate a buffer for containing the line, which must be freed by the user program. Alter-
natively, before calling getline(), *lineptr can contain a pointer to a malloc()-allocated buffer *n bytes in size. If the buffer is not
large enough to hold the line read in, getline() resizes the buffer to fit with realloc(), updating *lineptr and *n as necessary. In either
case, on a successful call, *lineptr and *n will be updated to reflect the buffer address and size respectively.
getdelim() works like getline(), except a line delimiter other than newline can be specified as the delimiter argument. As with getline(),
a delimiter character is not added if one was not present in the input before end of file was reached.
RETURN VALUE
On success, getline() and getdelim() return the number of characters read, including the delimiter character, but not including the termi-
nating null character. This value can be used to handle embedded null characters in the line read.
Both functions return -1 on failure to read a line (including end of file condition).
ERRORS
EINVAL Bad parameters (n or lineptr is NULL, or stream is not valid).
EXAMPLE
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
FILE * fp;
char * line = NULL;
size_t len = 0;
ssize_t read;
fp = fopen("/etc/motd", "r");
if (fp == NULL)
exit(EXIT_FAILURE);
while ((read = getline(&line, &len, fp)) != -1) {
printf("Retrieved line of length %zu :
", read);
printf("%s", line);
}
if (line)
free(line);
return EXIT_SUCCESS;
}
CONFORMING TO
Both getline() and getdelim() are GNU extensions. They are available since libc 4.6.27.
SEE ALSO read(2), fopen(3), fread(3), gets(3), fgets(3), scanf(3)GNU 2001-10-07 GETLINE(3)