Sponsored Content
Top Forums Shell Programming and Scripting Grep into a file + show following lines Post 302794117 by Arkadia on Monday 15th of April 2013 07:51:04 AM
Old 04-15-2013
Grep into a file + show following lines

Hi guys,
This is probably very easy but I've no idea how to pull this out.

Basically, I need to find errors into a very large logfile. When you grep the ID, the output is like this:

Code:
 +- Type: 799911 Code:  Ret: 22728954 Mand: X Def:  Des:  UserDes:  SeqNo: 2
  +- Type: 799911 Code:  Ret: 22728954 Mand: X Def:  Des:  UserDes:  SeqNo: 2
  +- Type: 799911 Code:  Ret: 22728954 Mand: X Def:  Des:  UserDes:  SeqNo: 2
  +- Type: 799911 Code:  Ret: 22728954 Mand: X Def:  Des:  UserDes:  SeqNo: 2

Those are multiple occurrences of the same action.
What I need to do is to take only one of these results (because they are identical) and show the next 30 lines in the file, starting from the grep line, to highlight the error.

Is it doable?
Thank you Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Need ls to show number of lines in each file

Hi, I need a command that would let ls show number of lines in each file rather than file size in KBs. I tried using wc -l as a source of input to ls but I found a problem cutting the file name since wc generates a space delimited list. Any suggestions? Thanks. GmMike. (1 Reply)
Discussion started by: GMMike
1 Replies

2. Shell Programming and Scripting

grep to show lines only after pattern

When i grep for a pattern the search results comes up with matching lines(some before the pattern and some after)...how can i limit the search so that it shows only the lines after the pattern specified (5 Replies)
Discussion started by: wannalearn
5 Replies

3. Shell Programming and Scripting

Grep string but also it will show the next 5 lines

Hi experts, I want to grep a number 9366109380 from a file but it will also show me the next 5 lines. Below is the example- when i grep 989366109380, i can also see the next 5 lines. Line 1. <fullOperation>MAKE:NUMBER:9366109380:PPAY2;</fullOperation> Line 2.... (10 Replies)
Discussion started by: thepurple
10 Replies

4. Shell Programming and Scripting

grep to show date/time of file the string was found in.

I've seen several examples of grep showing the filename the string was found in, but what I really need is grep to show the file details in long format (like ls -l would). scenario is: grep mobile_number todays_files This will show me the string I'm after & which files they turn up in, but... (2 Replies)
Discussion started by: woodstock
2 Replies

5. Shell Programming and Scripting

Grep command to show only process name

Can I modify the grep command to show only a process name? Currently I run ps -efa | grep chk_web to get the following: mousr 3395 1 0 09:36:06 pts/10 0:00 sh /var/opt/scripts/chk_web.sh Can this be changed in any way to get only: /var/opt/scripts/chk_web.sh or chk_web.sh. I... (3 Replies)
Discussion started by: runnerpaul
3 Replies

6. Shell Programming and Scripting

Extracting specific lines of data from a file and related lines of data based on a grep value range?

Hi, I have one file, say file 1, that has data like below where 19900107 is the date, 19900107 12 144 129 0.7380047 19900108 12 168 129 0.3149017 19900109 12 192 129 3.2766666E-02 ... (3 Replies)
Discussion started by: Wynner
3 Replies

7. Shell Programming and Scripting

[Solved] Show lines above and below!

hello team - anyone can help shwoing how to grep a file showing the lines above and below? Thx Bragabio (7 Replies)
Discussion started by: bragabio
7 Replies

8. Shell Programming and Scripting

sed show lines text between 2 blank lines

I have a file like blah blah blah blah this is the text I need, which might be between 1-4 lines, but always has a blank line above and below it, and is at the end of the text file the code tags don't show the trailing blank line. I started by deleting the last blank line with: ... (2 Replies)
Discussion started by: unclecameron
2 Replies

9. UNIX for Advanced & Expert Users

Grep show file name once

I am using grep as follows grep --include \*.org -ir "sunspot" -C 3 ./astron_aphys/solarsy/sun/helioseism/localhs/fhankel/ This gives me the filename for each matched line. How can I change the command to print the file name only once rather than having the same file name repeated at... (2 Replies)
Discussion started by: kristinu
2 Replies

10. Shell Programming and Scripting

Grep: show only first match per line?

Hi, can I make grep stop after finding the first occurrence of a regex in a line? Given: file with various regex patterns file to be grep'ed Sadly some of the regex patterns cannot be limited any further, so grep -Eiof patterns.txt file.txt (GNU grep 2.20) will give me possibly n hits... (4 Replies)
Discussion started by: stresing
4 Replies
snmp_framework_mib(3erl)				     Erlang Module Definition					  snmp_framework_mib(3erl)

NAME
snmp_framework_mib - Instrumentation Functions for SNMP-FRAMEWORK-MIB DESCRIPTION
The module snmp_framework_mib implements instrumentation functions for the SNMP-FRAMEWORK-MIB, and functions for initializing and configur- ing the database. The configuration files are described in the SNMP User's Manual. EXPORTS
configure(ConfDir) -> void() Types ConfDir = string() This function is called from the supervisor at system start-up. Inserts all data in the configuration files into the database and destroys all old data. Thus, the data in the SNMP-FRAMEWORK-MIB, after this function has been called, is from the configuration files. All snmp counters are set to zero. If an error is found in the configuration file, it is reported using the function config_err/2 of the error report module, and the function fails with reason configuration_error . ConfDir is a string which points to the directory where the configuration files are found. The configuration file read is: context.conf . init() -> void() This function is called from the supervisor at system start-up. Creates the necessary objects in the database if they do not exist. It does not destroy any old values. add_context(Ctx) -> Ret Types Ctx = string() Ret = {ok, Key} | {error, Reason} Key = term() Reason = term() Adds a context to the agent config. Equivalent to one line in the context.conf file. delete_context(Key) -> Ret Types Key = term() Ret = ok | {error, Reason} Reason = term() Delete a context from the agent config. Ericsson AB snmp 4.19 snmp_framework_mib(3erl)
All times are GMT -4. The time now is 11:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy