In this case you might have to write something in awk for example to have a similar functionality.
Althoug there is an old version of GNUgrep in the official IBM Linux toolbox available, just in case you were allowed to install this one.
---------- Post updated at 05:32 PM ---------- Previous update was at 04:30 PM ----------
Without focus on parsing input etc., here a solution in awk how it could look like:
Examples:
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi.
You can use a perl work-alike, for example, wgrep, a windowing-grep. It is not a "call-alike" because the options are somewhat different. Here's a sample run on AIX 5.1:
producing:
So you could place wgrep in a directory in your PATH, say ~/bin, and use it directly.
There is a even better work-alike, "ack", that has many of the same options as GNU grep. That is also in perl, and it ran correctly in Linux, hp-ux, and Solaris. Regrettably, it did not run on the AIX 5.1 that I use -- but perhaps it would run on yours.
The URLs in the script comments point to the sites where you can get the code.
If you do not have or know how to create a ~/bin and place it into your PATH, please do some research -- that is a far more general question, but not difficult once one understands the principles involved.
Hi,
here are few lines present in the logs. I want to grep on Error and print few lines before and after Error word is found
line1
Line2
Line3
Error
Line4
Line5
Line6
Line7
I want the output to be
Line2
Line3
Error
Line5 (1 Reply)
Hello,
I have two files file 1 and file 2 each having result of a query on certain database tables and need to compare for Col1 in file1 with Col3 in file2, compare Col2 with Col4 and output the value of Col1 from File1 which is a) not present in Col3 of File2 b) value of Col2 is different from... (2 Replies)
Hi Guys,
I have file like below, I want to print all lines between test1231233 to its 10 occurrence(till line 41)
test1231233
qwe
qwe
qweq123
test1231233
qwe
qwe
qweq23
test1231233
qwe
qwe
qweq123
test1231233
qwe
qwe
qweq123131 (3 Replies)
Hello everyone,
I have a little script below:
die "Usage infile outfile reGex" if @ARGV != 3;
($regex) = @ARGV;
open(F,$ARGV) or die "Can't open";
open(FOUT,"+>$ARGV") or die "Can't open";
while (<F>)
{
print FOUT if /$regex/.../$regex/;
}
No matter what I give $regex on the... (2 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)
Dear Experts,
I have file called file1 in which i am greping a pattern after that i want to next 3 lines when that pattern is matched.
Ex:- file1
USA
UK
India
Africa
Hello
Asia
Europe
Australia
Hello
Peter
Robert
Jo
i want to next 3 lines after matching Hello... (12 Replies)