I've been trying with this script and tried to modify it but it is not working in my new instance. I want to do the same thing but I want to extract until the newline is encountered. This means I read the text after .W and keep extracting the text until a newline is encountered not .A this time.
I've tried with this but not working:
My input and output are all same but instead of .A I read until newline when I start from .W
i have textfiles that contain a series of lines that look like this:
string0 .................................................... column3a column4a
string1**384y0439 ..................................... column3b column4b... (2 Replies)
Dear Folks :),
I am new to UNIX scripting and I do not know how can I insert some text in the first column of a UNIX text file at command promtp.
I can do this in vi editor by using this command :g/^/s//BBB_
e,g I have a file named as Test.dat and it containins below text:
michal... (4 Replies)
Hi,
I have a file from which i need to extract data between two constant strings.
The data looks like this :
Line 1 SUN> read db @cmpd unit 60
Line 2 Parameter: CMPD -> "C00071"
Line 3
Line 4 SUN> generate
Line 5 tabint>ERROR: (Variable data)
The data i need to extract is... (11 Replies)
There are a lot of ways to extract text from between two strings, but what if those strings occur multiple times and you only want the text from the first two strings? I can't seem to find anything to work here. I'm using sed to process the text after it's extracted, so I prefer a sed answer, but... (4 Replies)
Hi,
I've looked at a few existing posts on this, but they don't seem to work for my inputs.
I have a text file where I want to extract all the text between two strings, every time that occurs.
Eg my input file is
Anna said that she would fetch the bucket.
Anna and Ben moved the bucket.... (9 Replies)
Hi experts,
Ive got a text file which has the following text which will occur in this format at least one time:
+=========================>>
Some stuff that evreryone should knnow
other stufsjdokajkajokajda
aijhjajcdjajcisajcqsqdqwdqad
<<=========================+
It is likely that... (8 Replies)
Here is my task, I feel sure this can be accomplished with see/awk but can't seem to figure out how.
I have large flat file from which I need to extract every case of a pairing of characters (GG) in this case PLUS the previous 20 characters. The output should be a list (which I plan to make... (17 Replies)
Hi Team -
I hope everyone has been well!
I export a file from one of our source systems that gives me more information than I need. The way the file outputs, I need to extract certain strings at different positions on the file and echo them to another file.
I can do this in batch easily,... (2 Replies)
Discussion started by: SIMMS7400
2 Replies
LEARN ABOUT OPENSOLARIS
fgets
gets(3C) Standard C Library Functions gets(3C)NAME
gets, fgets - get a string from a stream
SYNOPSIS
#include <stdio.h>
char *gets(char *s);
char *fgets(char *s, int n, FILE *stream);
DESCRIPTION
The gets() function reads bytes from the standard input stream (see Intro(3)), stdin, into the array pointed to by s, until a newline char-
acter is read or an end-of-file condition is encountered. The newline character is discarded and the string is terminated with a null byte.
If the length of an input line exceeds the size of s, indeterminate behavior may result. For this reason, it is strongly recommended that
gets() be avoided in favor of fgets().
The fgets() function reads bytes from the stream into the array pointed to by s, until n-1 bytes are read, or a newline character is read
and transferred to s, or an end-of-file condition is encountered. The string is then terminated with a null byte.
The fgets() and gets() functions may mark the st_atime field of the file associated with stream for update. The st_atime field will be
marked for update by the first successful execution of fgetc(3C), fgets(), fread(3C), fscanf(3C), getc(3C), getchar(3C), gets(), or
scanf(3C) using stream that returns data not supplied by a prior call to ungetc(3C) or ungetwc(3C).
RETURN VALUES
If end-of-file is encountered and no bytes have been read, no bytes are transferred to s and a null pointer is returned. For standard-con-
forming (see standards(5)) applications, if the end-of-file indicator for the stream is set, no bytes are transferred to s and a null
pointer is returned whether or not the stream is at end-of-file. If a read error occurs, such as trying to use these functions on a file
that has not been opened for reading, a null pointer is returned and the error indicator for the stream is set. If end-of-file is encoun-
tered, the EOF indicator for the stream is set. Otherwise s is returned.
ERRORS
Refer to fgetc(3C).
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO lseek(2), read(2), ferror(3C), fgetc(3C), fgetwc(3C), fopen(3C), fread(3C), getchar(3C), scanf(3C), stdio(3C), ungetc(3C), ungetwc(3C),
attributes(5), standards(5)SunOS 5.11 15 Oct 2003 gets(3C)