need help on this. let say i hv 1 file contains as below:
STRING
Description bla bla bla
Description yada yada yada
Data bla bla
Data yada yada
how do i want to display n lines after the string?
thanks in advance! (8 Replies)
i need to grep a STRING_A & the next few lines after the STRING_A
example file:
STRING_A yada yada
line 1
line 2
STRING_B yada yada
line 1
line 2
line 3
STRING_A yada yada
line 1
line 2
line 3
line 4
STRING_A yada yada
line 1
line 2
line 3
line 4 (7 Replies)
Hi,
I have a log file that I need to monitor as it's being written to, and I want to exclude certain strings from the output. At the moment I'm using ...
tail -f LogFileName_`date +%d`.log | egrep -v "First String To Exclude | 2nd string | 3rd string" ...which works OK - but now I need to... (1 Reply)
Hi folks
I am not allowed to install GNU grep on AIX.
Here my code excerpt:
grep_fatal () {
/usr/sfw/bin/gegrep -B4 -A2 "FATAL|QUEUE|SIGHUP"
}
Howto the same on AIX based machine?
from manual GNU grep
‘--after-context=num’
Print num lines of trailing context after... (4 Replies)
I have several very large file that are extracts from Oracle tables. These files are formatted in XML type syntax with multiple entries like:
<ROW>
some information
more information
</ROW>
I want to grep for some words, then print all lines between <ROW> AND </ROW>. Can this be done with AWK?... (7 Replies)
RHEL 5.8
I have a text file like below. I want to grep for a string and then print the next 4 lines including the line with the string I grepped for
For eg:
I want grep for the string HANS and then print the next 4 lines including HANS
$ cat someText.txt
JOHN
NATIONALITY:... (7 Replies)
I have a large dataset with following structure;
C 0001 Carbon
D SAR001 methane
D SAR002 ethane
D SAR003 propane
D SAR004 butane
D SAR005 pentane
C 0002 Hydrogen
C 0003 Nitrogen
C 0004 Oxygen
D SAR011 ozone
D SAR012 super oxide
C 0005 Sulphur
D SAR013... (3 Replies)
STRVARS(3pub) C Programmer's Manual STRVARS(3pub)NAME
strvars - expand variables in string
SYNOPSIS
#include <publib.h>
int strvars(char **res, const char *str, char *(*expand)(const char *));
DESCRIPTION
strvars will replaces references to variables in the string str with the values of the variables. A reference to a variable is of the form
$(foo) or $x (where x is a single character, but not $). A dollar sign is expressed in the string as $$, and will be converted to $ in the
output. Memory for the expanded string is allocated dynamically, and *res is set to point to it.
The values of the variables are fetched using the function expand. It is given the name of the variable as its argument, and must return a
pointer to the value, or NULL if that variable doesn't exist.
RETURN VALUE
strvars will return 0 if successful, or NULL if an error occured (malformed input string, result too big, or unknown variable).
EXAMPLE
To replace references to environment variables, one would the following.
#include <publib.h>
#include <stdlib.h>
char line[1024];
char *res;
if (strvars(&res, line, getenv) == NULL)
errormsg(1, 0, "strvars failed");
printf("res = <%s>
", res);
SEE ALSO publib(3), getenv(3)AUTHOR
Lars Wirzenius (lars.wirzenius@helsinki.fi)
Publib C Programmer's Manual STRVARS(3pub)