Multiple selective keyword Report

Tags
keyword, multiple, report, shell scripts

 
Thread Tools Search this Thread
# 1  
Old 1 Week Ago
Multiple selective keyword Report

Dear All,
I have a question on what is the best way to control and list out multiple selective keywords to print out the report
Below is the Sample output of the listing

Code:
Code1
Code1
Code1
Identifier "Job"
Code2
Code2
Code2
Name "Impressive"
Code3
Code3
Code3
AGT_Manual
Code1
Code1
Code1
Identifier "Findme"
Code2
Code2
Code2
Name "Positive"
Code3
Code3
Code3
Code3
Code3 
Code3
AGT_AUTO
Code1
Code1
Code1
Identifier "Job"
Code2
Code2
Code2
Name "Not Here"
Code3
Code3
Code3
AGT_Manual
Code1
Code1
Code1
Identifier "Findme"
Code2
Code2
Code2
Code2
Code2
Name "Positive"
Code3
Code3
Code3
Code3
Code3
AGT_AUTO

Expected Output 1

Code:
[Lineno] : Identifier "Findme"      Name "Positive"    AGT_AUTO
[Lineno] : Identifier "Findme"      Name "Positive"    AGT_AUTO

Expected Output
Code:
[Lineno] : Identifier "Findme"      Name "Positive"   Code3     AGT_AUTO
                                                      Code3
                                                      Code3

[Lineno] : Identifier "Findme"      Name "Positive"   Code3     AGT_AUTO
                                                      Code3
                                                      Code3

Remarks : Lineno : is the rowno of the Identifier "Findme" in the source file
               Code3 only shown top 3 lines

Thanks for all your time scratching your head to think of the solution.
# 2  
Old 1 Week Ago
Hello ckwan,

After 60 posts, I'd hope you could help us out a little here. I have a few to questions pose in response first:-
  • Is this homework/assignment? There are specific forums for these.
  • What have you tried so far?
  • Are the line numbers to display meant to just be sequential in the output or to represent the line it is found in the input?
    • Where you have two items found being written on the same output line, which input line would you want it to refer to?
  • What output/errors do you get?
  • What OS and version are you using?
  • What are your preferred tools? (C, shell, perl, awk, etc.)
  • What logical process have you considered? (to help steer us to follow what you are trying to achieve)
Most importantly, What have you tried so far?

There are probably many ways to achieve most tasks, so giving us an idea of your style and thoughts will help us guide you to an answer most suitable to you so you can adjust it to suit your needs in future.


We're all here to learn and getting the relevant information will help us all.

Kind regards,
Robin
These 2 Users Gave Thanks to rbatte1 For This Post:
Don Cragun (1 Week Ago) vgersh99 (1 Week Ago)
# 3  
Old 1 Week Ago
In addition to what Robin has already said, we also need a clear English description of what you are trying to do.

It looks like you want to ignore every line of input that does not have "C" as the first character on the line and then look at the remaining lines in groups of three. If the first line of a group is not literally Identifier "Findme" and the second line of a group is not literally Name "Positive" and the third line of a group is not literally AGT_AUTO then that group should also be ignored.

If that is what you're trying to do, I don't understand why producing that output would be important to anyone. It would seem that just knowing how many times a group matched each of those lines in sequence might be much more useful.
# 4  
Old 1 Week Ago
Hi Robin,
I can use awk command however cannot achieve the output I wanted. This is for my own interest and this is not assignment.

Code:
    awk '/Identifier "Name"/ { print $0; getline;getline;getline; print $0 } /AGT_AUTO/ {print $0 }' listing.out

Hi Don,
Imagine I have large file which contains all the mixture data. The main purpose of this is to identify and select only those multiple keywords from the list and tabular out into report.
Another purpose is from the output I can cross check against my original list by using lineno.

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Search for a Keyword in file and replace another keyword or add at the end of line dashing201 Shell Programming and Scripting 7 05-05-2014 05:04 PM
Selective printing anil510 Shell Programming and Scripting 9 03-04-2013 03:32 PM
Selective replace siya@ UNIX for Dummies Questions & Answers 11 01-24-2013 09:15 PM
Need help: Script to report timestamp of directories in a specific path from multiple Linux server sudhichadaga Shell Programming and Scripting 1 09-21-2012 05:31 AM
Selective grouping anil510 Shell Programming and Scripting 8 06-14-2012 03:25 AM
Selective grep anil510 Shell Programming and Scripting 9 05-19-2012 01:53 AM
Help with selective ls newbie_01 UNIX for Dummies Questions & Answers 7 04-03-2012 08:58 AM
selective grep verse123 UNIX for Dummies Questions & Answers 6 01-24-2012 11:19 AM
Need to develop a script to create a report reading multiple server logs scriptingnewbie Shell Programming and Scripting 5 03-21-2011 03:33 PM
Removing Multiple lines below a keyword using SED? deaconf19 Shell Programming and Scripting 2 02-10-2011 09:31 AM
How to convert 2 column data into multiple columns based on a keyword in a row?? ks_reddy Shell Programming and Scripting 1 02-16-2010 06:35 AM
Selective input passing, for cron with multiple interval vikram3.r Shell Programming and Scripting 2 11-11-2009 09:42 PM
multiple search keyword in grep saifurshaon Shell Programming and Scripting 11 03-19-2009 06:56 AM
Selective Umask baanprog UNIX for Advanced & Expert Users 3 08-03-2006 10:48 AM
echo is selective? rgard Shell Programming and Scripting 0 12-01-2005 04:47 PM