Sponsored Content
Top Forums Shell Programming and Scripting Multiple selective keyword Report Post 303028615 by ckwan on Friday 11th of January 2019 07:53:50 AM
Old 01-11-2019
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.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

multiple search keyword in grep

Dear All, I have a file containing info like TID:0903 asdfasldjflsdjf TID:0945 hjhjhkhkhkh TID:2045 hjhjhkhkhkh TID:1945 hjhjhkhkhkh TID:2045 hjhjhkhkhkh I need to show only lines containing TID:0903 asdfasldjflsdjf TID:0945 hjhjhkhkhkh TID:2045 hjhjhkhkhkh TID:2045 hjhjhkhkhkh ... (11 Replies)
Discussion started by: saifurshaon
11 Replies

2. Shell Programming and Scripting

Selective input passing, for cron with multiple interval

0,0 4,5 11 11 * /pkgs/roots/scripts/job_monitor.ksh i have the requirement like, for the first time(4) the script should have the input parameter as "Value1" but the second time(5) it should have the input parameter as "Value2" Can we achieve this using any cron options ? If yes, How..??... (2 Replies)
Discussion started by: vikram3.r
2 Replies

3. Shell Programming and Scripting

How to convert 2 column data into multiple columns based on a keyword in a row??

Hi Friends I have the following input data in 2 columns. SNo 1 I1 Value I2 Value I3 Value SNo 2 I4 Value I5 Value I6 Value I7 Value SNo 3 I8 Value I9 Value ............... ................ SNo N (1 Reply)
Discussion started by: ks_reddy
1 Replies

4. Shell Programming and Scripting

Removing Multiple lines below a keyword using SED?

I have 9,000 + html files. I am using the following to remove the content from a certain line up for i in `ls` do sed '1,569d' $i > $i.bak done This will remove the unwanted formatting keeping the content I need which changes in each HTML file. the problem I have now is that the... (2 Replies)
Discussion started by: deaconf19
2 Replies

5. Shell Programming and Scripting

Need to develop a script to create a report reading multiple server logs

I am currently trying to develop a script to connect to mulltiple servers, reading specifc data from log files on the servers and append the data from each file into a single tab delimited row. So, at the end I am planning to have a report with all the extracted data with each row per server. I am... (5 Replies)
Discussion started by: scriptingnewbie
5 Replies

6. UNIX for Dummies Questions & Answers

selective grep

Hello, I have been using the command below for file manipulation. while read A B; do grep $f1; done < f2 > f3 So, if a certain string is found in f2 (for ex; DOG243435) and it is also present in f1, then print that string plus the contents of the line in which it was found onto f3. ... (6 Replies)
Discussion started by: verse123
6 Replies

7. UNIX for Dummies Questions & Answers

Help with selective ls

Hi all :wall: Can anyone advise how do I use ls to do a selective amd sorted listing of file that I want to have as below? Am looking for files that are named as log_<nnnn>.txt, where <nnnn> are numeric, i.e. I want to have a listing sorted from the newest to the oldest of files that... (7 Replies)
Discussion started by: newbie_01
7 Replies

8. Shell Programming and Scripting

Selective grouping

I have a text file in this format. Group: AAA Notes: IP : 11.11.11.11 #User xxxxxxxxx #Password aaaaaaaaaaaaaaaa Group: AAA Notes: IP : 11.11.11.22 #User yyyyyyyyyyyyy #Password bbbbbbbbbbbbb (8 Replies)
Discussion started by: anil510
8 Replies

9. Shell Programming and Scripting

Need help: Script to report timestamp of directories in a specific path from multiple Linux server

Need help Please help on how to write a script which can echo timestamp, size of subdirectories in a specific path from multiple Linux servers to a text file. I can ssh with a common user to all the servers from a build box. Basic idea what I had was: ssh <commonuser>@<each box> cd... (1 Reply)
Discussion started by: sudhichadaga
1 Replies

10. Shell Programming and Scripting

Search for a Keyword in file and replace another keyword or add at the end of line

Hi I want to implement something like this: if( keyword1 exists) then check if(keyword2 exists in the same line) then replace keyword 2 with New_Keyword else Add New_Keyword at the end of line end if eg: Check for Keyword JUNGLE and add/replace... (7 Replies)
Discussion started by: dashing201
7 Replies
LOCALE(1)						    BSD General Commands Manual 						 LOCALE(1)

NAME
locale -- get locale-specific information SYNOPSIS
locale [-a | -m] locale [-ck] [keyword ...] DESCRIPTION
The locale utility is supposed to provide most locale specific information to the standard output. When locale is invoked without arguments it will print out a summary of the current locale environment depending on environment variable set- tings and internal status. When locale is invoked with arguments and no options specified it will print out keyword's value determined using current locale settings. The following options are available: -a Write names of all available locales. While looking for locales locale will respect the PATH_LOCALE environment variable, and use it instead of the system default locale directory. -c Write the category name for the selected keywords. -k Write the name and value of the selected keywords. -m Write names of all available charmaps. IMPLEMENTATION DETAILS
Special (FreeBSD- / NetBSD-specific) keyword list can be used to retrieve a human readable list of available keywords. DIAGNOSTICS
The locale utility exits 0 on success, and >0 if an error occurs. STANDARDS
locale conforms to IEEE Std 1003.1-2001 (``POSIX.1''). HISTORY
locale first appeared in NetBSD 2.0. AUTHORS
This implementation of locale was originally written by Alexey Zelkin <phantom@FreeBSD.org> for FreeBSD. BUGS
Since NetBSD does not support charmaps in their POSIX meaning locale emulates the -m option via CODESETs listing of all available locales. BSD
July 4, 2003 BSD
All times are GMT -4. The time now is 08:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy