LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices


Reply
  Search this Thread
Old 04-07-2015, 02:57 PM   #1
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
grep group of lines from file


hi, i have a file that looks like this. i am trying to carve out the portion in purple but this is the error i am getting. can someone help me formulate a command to grep out the lines i need:
Code:
 !! END OF JES SPOOL FILE !!
...
0 REJECT COUNT =        0           0           0
0 RECYCLE COUNT =      38           0          38
0 RELEASE RATE  =   58.36        .00 %     58.36 %
104/06/15  12:24:59   TO   04/06/15  12:24:59                       hyper HEALTHCARE                              PAGE   247   04/07/15
 CLPB0B0X-A                                                         MKT-SEG TOTALS                                          13:54:30
0
-                  CLAIMS  ENCOUNTERS       TOTAL
0 HEADERS =           610           0         610
0 DETAILS =         1,478           0       1,478
0 QUALITY COUNT =       0           0           0
0 RELEASE COUNT =     356           0         356
0 PEND COUNT =        254           0         254
0 VOID COUNT =          0           0           0
0 REJECT COUNT =        0           0           0
0 RECYCLE COUNT =      38           0          38
0 RELEASE RATE  =   58.36 %       .00 %     58.36 %
104/06/15  12:24:59   TO   04/06/15  12:24:59                       hyper HEALTHCARE                              PAGE   248   04/07/15
 CLPB0B0X-A                                                         MKT-SEG TOTALS                                          13:54:30
0  ALL MKT SEGMENTS
-                  CLAIMS  ENCOUNTERS       TOTAL
0 HEADERS =           610           0         610
0 DETAILS =         1,478           0       1,478
0 QUALITY COUNT =       0           0           0
0 RELEASE COUNT =     356           0         356
0 PEND COUNT =        254           0         254
0 VOID COUNT =          0           0           0
0 REJECT COUNT =        0           0           0
0 RECYCLE COUNT =      38           0          38
0 RELEASE RATE  =   58.36 %       .00 %     58.36 %
 !! END OF JES SPOOL FILE !!
104/07/15                                                            hyper HEALTHCARE                              PAGE     1
 CLPB0B0X-B                                                      PENDED BY UNIT SUMMARY
0  AEAK30
0                      UNIT       NO. OF CLAIMS    NO. OF ENCOUNTERS      TOTAL
                       ----       -------------    -----------------      -----

104/07/15                                                            hyper HEALTHCARE                              PAGE     2
 CLPB0B0X-B                                                      PENDED BY UNIT SUMMARY
0  AEAL30
...
 !! END OF JES SPOOL FILE !!

grep -B 2 -A 10 "0  ALL MKT SEGMENTS" mainframe-ftp.log
grep: Not a recognized flag: B
Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list...
        [-f pattern_file...] [file...]
Usage: grep [-r] [-R] [-H] [-L]  [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...]
        -f pattern_file... [file...]
Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] pattern_list [file...]

Last edited by schneidz; 04-07-2015 at 02:58 PM.
 
Old 04-07-2015, 03:27 PM   #2
wingnut64
Member
 
Registered: Sep 2004
Distribution: AIX, RHEL, Ubuntu
Posts: 51

Rep: Reputation: 23
AIX's version of grep doesn't support context options like -A or -B, although it does have a nice -P option for paragraph. You'll need to use awk, perl or something similar.
 
Old 04-08-2015, 12:08 AM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,852
Blog Entries: 1

Rep: Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868
Install gnu grep (http://www.perzl.org/aix/index.php?n=Main.Grep). The executable will be /opt/freeware/bin/grep
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
grep and display the below lines in file sunilsagar Programming 3 02-01-2012 09:43 AM
grep and store two lines in other file jkeertir Linux - Newbie 6 02-16-2011 07:32 PM
[SOLVED] grep ??? searching a file and outputting 5 lines either side... redhatuser1 Linux - Newbie 2 09-29-2010 03:45 AM
Using CAT / GREP to remove a set of lines from a file wesgarner Linux - Newbie 13 11-14-2009 10:41 AM
script to grep lines out of a file qipman Linux - General 5 09-26-2007 12:01 PM

LinuxQuestions.org > Forums > Other *NIX Forums > AIX

All times are GMT -5. The time now is 07:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration