I am very new to Unix. What are the similiarities and differences between ScoUnix and AIX5 if any? Where might i find the information? Which is better? (1 Reply)
i want to know the similarities and disimilarities of Unix and Windows file systems . methods of file , file orgsnization , meaning of file extension , file and disk fragments :confused::confused: (1 Reply)
Hello Everybody!!!!!!!!! Request you to help me with the below mentioned issue:
I have 2 files say,
File 1:
a|4|7
b|3|2
c|8|8
d|8|9
File 2:
a|4|6
b|2|2
c|8|8
d|9|8
The third file(output file) should have:
Data mismatch in row 1 column 3
Data mismatch in row 2 coumn 2
Data... (3 Replies)
Hello everyone!!!!! Need some help on inserting data in a file columnwise.
Example:
File1:
1|AAA|25|2
5|qqe|20|7
4|wer|31|81
I need to create a second file in which data can be inserted in a columnwise manner i.e.
File2:
AAA|25|1|2
qqe|20|5|7
wer|31|4|81
The order of columns in... (1 Reply)
Hello everyone!!!!! Need some help on inserting data in a file columnwise.
Example:
File1:
1|AAA|25|2
5|qqe|20|7
4|wer|31|81
I need to create a second file in which data can be inserted in a columnwise manner i.e.
File2:
AAA|25|1|2
qqe|20|5|7
wer|31|4|81
The order of columns in... (1 Reply)
Hi ,
I have a CSV file that has around 50K records in it. I have to delete all the duplicate rows from the file except one, depending upon data in column4.
Lets say there are 3 rows for 'column4data' in the file. I have to retain only that line which has the smallest date value in column2.... (3 Replies)
Hi All,
I want to trim each columns leading & trailing (like sql trim function) of a ',' separated file..
I've a file like this..
manab , c gi
lucky , home
babu , maa
I want the output as
manab,c gi
lucky,home
babu,maa
A one liner would be a great help. (2 Replies)
hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file
<sequence>
<Filename>aldorzum.doc</Filename>
<DivisionCode>US</DivisionCode>
<ContentType>Template</ContentType>
<ProductCode>VIMZIM</ProductCode>
</sequence>... (4 Replies)
I have two files which has component name and version number separated by a space
cat file1
com.acc.invm:FNS_PROD 94.0.5
com.acc.invm:FNS_TEST_DCCC_Mangment 94.1.6
com.acc.invm:FNS_APIPlat_BDMap 100.0.9
com.acc.invm:SendEmail 29.6.113
com.acc.invm:SendSms 12.23.65
cat file2 ... (8 Replies)
Discussion started by: rakeshtomar82
8 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)