Many thanks, Corona688.
After I reading the 'man strcmp' and 'man fputs'. I understanding the reason why you using 'strcmp' and 'fputs' while coding
I just wondering why that "if(fgets(buf, 4096, fin)== NULL ) continue;" will print out only the line next to "@HWI instead of other line?
"fgets" will "Get string from stream" and read through it from the input file.
Many thanks to explain the reason that "if(fgets(buf, 4096, fin)== NULL ) continue;" will only print the second line shown in above example instead of other line.
I'm still beginner and maybe someone can help me.
I have this input:
the great warrior a, b, c
and what i want to know is, with awk, how can i detect the string with 'warrior' string on it and print the a, b, and c seperately, become like this :
Warrior Type
a
b
c
Im still very... (3 Replies)
Hi,
I am writing a shell script to parse some files, and gather data.
The data in the files is displayed as below.
.......xyz: abz: ......qrt: ....
.......xyz: abz: ......qrt: ...
I have tried using awk and cut, but the position of these values keep changing, so I wasn't able to get... (2 Replies)
how to use "awk" to print any record has pattern not equal ? for example my file has 5 records & I need to get all lines which $1=10 or 20 , $2=10 or 20 and $3 greater than "130302" as it shown :
10 20 1303252348212B030
20 10 1303242348212B030
40 34 1303252348212B030
10 20 ... (14 Replies)
I have
2013-06-11 23:55:14 1Umexd-0004cm-IG <= user@domain.com
I need sed/awk operation on this, so that it should print the very next pattern only after the the pattern mach <=
ie only print user@domain.com (7 Replies)
Hello Experts , require help . See below output:
File inputs
------------------------------------------
Server Host = mike
id rl images allocated last updated density
vimages expiration last read <------- STATUS ------->... (4 Replies)
I have input file as below I need to check for a pattern and if it is there in file then I need to print all the lines below BEGIN and END keyword. Could you please help me how to get this in AIX using sed or awk.
Input file:
ABC
******** BEGIN *****
My name is Amit.
I am learning unix.... (8 Replies)
Take example of below file.
abc.txt
nas1:/abc/test/test1 /test
nas1:/abc/test/test1/test2 /test/abc
nas1:/abc/test/
Now i have a variable that contains "nas1:/abc/test/test1" value , so i need to search the above file for this variable and print only this line.
... (14 Replies)
Discussion started by: mohit_vardhani
14 Replies
LEARN ABOUT MOJAVE
fputs
FPUTS(3) BSD Library Functions Manual FPUTS(3)NAME
fputs, puts -- output a line to a stream
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <stdio.h>
int
fputs(const char *restrict s, FILE *restrict stream);
int
puts(const char *s);
DESCRIPTION
The function fputs() writes the string pointed to by s to the stream pointed to by stream.
The function puts() writes the string s, and a terminating newline character, to the stream stdout.
RETURN VALUES
The functions fputs() and puts() return a nonnegative integer on success and EOF on error.
ERRORS
[EBADF] The stream argument is not a writable stream.
The functions fputs() and puts() may also fail and set errno for any of the errors specified for the routines write(2).
COMPATIBILITY
fputs() now returns a non-negative number (as opposed to 0) on successful completion. As a result, many tests (e.g., "fputs() == 0",
"fputs() != 0") do not give the desired result. Use "fputs() != EOF" or "fputs() == EOF" to determine success or failure.
SEE ALSO ferror(3), fputws(3), putc(3), stdio(3)STANDARDS
The functions fputs() and puts() conform to ISO/IEC 9899:1990 (``ISO C90''). While not mentioned in the standard, both fputs() and puts()
print '(null)' if str is NULL.
BSD June 4, 1993 BSD