Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Dynamically accept search pattern and display lines based on it Post 302777221 by DGPickett on Thursday 7th of March 2013 01:13:31 PM
Old 03-07-2013
A shell loop can ask for the pattern, capture matching lines in a temp file, count the lines at the same time, and if any lines, turn you over to vi, pg, less in the temp file to view and play in the subset. When you exit the viewer, it asks you if you want to view again, and if not, loops. You can make any copies you want from inside the viewer.

Now, only a select few actually prefer the csh. The bash and ksh93 are much nicer and there are more experts to help.

PS: I use the ksh/bash 'set -o vi' option to do command recall, so I do not type commands over and over. I never even leave my home dir except inside (...) so I return automatically. It makes the history more valuable. I also save the history file occasionally where my tools can find it, and set a huge HISTSIZE of 32767. I consider one of the best CUI's.

Last edited by DGPickett; 03-07-2013 at 02:46 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search file for pattern and grab some lines before pattern

I want to search a file for a string and then if the string is found I need the line that the string is on - but also the previous two lines from the file (that the pattern will not be found in) This is on solaris Can you help? (2 Replies)
Discussion started by: frustrated1
2 Replies

2. Shell Programming and Scripting

Pattern matching in file and then display 10 lines above every time

hiii, i have to write a shell script like this---- i have a huge log file name abc.log .i have to search for a pattern name "pattern",it may occur 1000 times in the log file,every time it finds the pattern it should display the 10 lines above the pattern. I appericiate your help. (30 Replies)
Discussion started by: namishtiwari
30 Replies

3. Shell Programming and Scripting

Print a pattern between the xml tags based on a search pattern

Hi all, I am trying to extract the values ( text between the xml tags) based on the Order Number. here is the sample input <?xml version="1.0" encoding="UTF-8"?> <NJCustomer> <Header> <MessageIdentifier>Y504173382</MessageIdentifier> ... (13 Replies)
Discussion started by: oky
13 Replies

4. Shell Programming and Scripting

Search and replace - pattern-based

Hey folks! I am new to shell-scripting, but I have a problem that I would like to solve using a script. I create very large html forms, used for randomized trials. In these forms, each question is supplied with a variable that looks something like this: PROJECT_formNN Where NN is the question... (1 Reply)
Discussion started by: Roevhat
1 Replies

5. Shell Programming and Scripting

Extracting few lines from a file based on identifiers dynamically

i have something like this in a file called mysqldump.sql -- -- Table structure for table `Table11` -- DROP TABLE IF EXISTS `Table11`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Table11` ( `id` int(11) NOT NULL... (14 Replies)
Discussion started by: vivek d r
14 Replies

6. Shell Programming and Scripting

Need one liner to search pattern and print everything expect 6 lines from where pattern match made

i need to search for a pattern from a big file and print everything expect the next 6 lines from where the pattern match was made. (8 Replies)
Discussion started by: chidori
8 Replies

7. UNIX for Dummies Questions & Answers

Updating value based on search pattern

I have a file with following data <Field FieldName="CHCFA21_01_01" FieldType="Text"> <Output CapturedValue=""> <DataSource Name="" Value="" /> </Output> </Field> <Field FieldName="CHCFA21_01_02" FieldType="Date"> <Output CapturedValue=""> ... (1 Reply)
Discussion started by: nsuresh316
1 Replies

8. Shell Programming and Scripting

Display 2 lines before and after a particular pattern

Hi team, Is it possible to display 2 lines after a particular pattern in a shell script. For example in a file which has the below contents. Mummy Daddy Son Daughter Children Aunty Uncle Grandma Grandpa Son Father Mother Brother-in-law I want to display 2 lines before and after... (1 Reply)
Discussion started by: balamv
1 Replies

9. Shell Programming and Scripting

Search pattern on logfile and search for day/dates and skip duplicate lines if any

Hi, I've written a script to search for an Oracle ORA- error on a log file, print that line and the .trc file associated with it as well as the dateline of when I assumed the error occured. In most it is the first dateline previous to the error. Unfortunately, this is not a fool proof script.... (2 Replies)
Discussion started by: newbie_01
2 Replies

10. Shell Programming and Scripting

Grep pattern and display all lines below

Hi I need to grep for a patter and display all lines below the pattern. For ex: say my file has the below lines file1 file2 file3 file4 file5 I NEED to grep for patter file3 and display all lines below the pattern. do we have an option to get this data. Let me know if you require... (5 Replies)
Discussion started by: venkidhadha
5 Replies
mprof-heap-viewer(1)					      General Commands Manual					      mprof-heap-viewer(1)

NAME
mprof-heap-viewer - GUI viewer for the logging profiler heap snapshots SYNOPSIS
mprof-heap-viewer file DESCRIPTION
mprof-heap-viewer GUI viewer for the logging profiler heap snapshots WARNING: this application is unfinished and experimental. Nevertheless it should work, and bug reports are encouraged. This program decodes the contents of a logging profiler output file and locates all the heap snapshots inside it. The user can then select each individual snapshot and decide to load it in memory and explore its contents. The GUI is organized to work on "object sets" (listed in a tree view on the left). All operations are performed with a popup menu on the choosen set. Initially the sets are the heap snapshots (of course a heap snapshot can be considered a set of objects!). For each set the GUI shows on the right a list that breaks it down by class (one row for each class). The user can then refine each set using a "filter", to select a subset. Examples of filters are "all objects of class X", or "all objects that reference an object of class X". This way the user explores the sets breaking them down to subsets (each subset in the GUI is a child of its owner set on the tree view). Moreover the user can issue a "compare" operation between two arbitrary sets A and B, which will compute two subsets: "A - B" (the objects of A which are not in B, a subsect of A) and "B - A" (the reverse). This can help in understanding what changed on the heap between garbage collections. Options None ENVIRONMENT VARIABLES
None SEE ALSO
mono(1) COPYRIGHT
Copyright (C) 2008 Novell, Inc (http://www.novell.com) mprof-heap-viewer(1)
All times are GMT -4. The time now is 10:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy