Sponsored Content
Top Forums Shell Programming and Scripting read the first 10 lines below a keyword found by grep Post 302431768 by albertogarcia on Wednesday 23rd of June 2010 02:36:02 AM
Old 06-23-2010
maybe this?:

Code:
awk 'BEGIN{printline=0;cont=1} {if($2=="0xA")printline==1;if(printline==1 && cont<=10){print $0;cont++}}' IN_FILE

 

10 More Discussions You Might Find Interesting

1. AIX

grep to give how many times each lines were found

Lets say I have a file containing string patterns to be looked for inside a file. I would normaly do : grep -if MyFilePattern FiletoSearchInto if I use the -c it gives how many total lines it found out of my whole pattern file, but what if i want grep to report how many times it found each... (4 Replies)
Discussion started by: Browser_ice
4 Replies

2. UNIX for Dummies Questions & Answers

Grep and display n lines after the match is found.

Hello, How do I use grep to find a pattern in a list of file and then display 5 lines after the pattern is matched Eg: I want to match the string GetPresentCode in all files in a folder and then see 4 lines following this match. I am not sure if grep is what should be used to achieve. Thanks!... (3 Replies)
Discussion started by: cv_pan
3 Replies

3. Shell Programming and Scripting

Cut lines before keyword

Hi, How to cut all lines in file before keyword? from 1 2333214 word ...... some text 2 234343 234234 word ...... some text 3 234324 324 3234 word ...... some text to 1 2333214 2 234343 234234 3 234324 324 3234 (4 Replies)
Discussion started by: Trump
4 Replies

4. 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

5. Shell Programming and Scripting

Remove keyword found in title

Hello All, I have a bunch of files that have the following format, where the title is INPUT.txt and contains the following text: INPUT-FILLER1 204 INPUT-FILLER2 FILLER6-INPUT 5 FILLER-INPUT I want to go through the directory and remove the keyword INPUT. For example, my output would be... (5 Replies)
Discussion started by: jl487
5 Replies

6. Shell Programming and Scripting

printing a text until a keyword is found

Hi, here's the problem: text="hello1 hello2 world earth mars jupiter planet"how do I print the text until it finds the keyword "mars" so that the desired output is output="hello1 hello2 world earth" I have rtfm of sed and I think the problem is, that if I find the word "mars" it will... (7 Replies)
Discussion started by: icantfindauser
7 Replies

7. Shell Programming and Scripting

How to grep multi line with keyword ?

Hi All. how to grep with same keyword. 23-07-2012 15:15:30,117 ::: Recieve Message From Commadu ::: .. ... .... 23-07-2012 16:15:28,481 ::: Recieve Message From Commadu ::: 23-07-2012 16:15:28,481 IP : 127.0.0.1 | msg =... (1 Reply)
Discussion started by: ooilinlove
1 Replies

8. Shell Programming and Scripting

How to print few lines before and after matching word is found suing grep?

Hi, here are few lines present in the logs. I want to grep on Error and print few lines before and after Error word is found line1 Line2 Line3 Error Line4 Line5 Line6 Line7 I want the output to be Line2 Line3 Error Line5 (1 Reply)
Discussion started by: arghadeep adity
1 Replies

9. Shell Programming and Scripting

Issue in using read keyword twice

Hi, I have a situation where i need to read line by line from a text pad and with each line , i need to take inputs from command line and do some process. Using below code i am not able to use 'read' keyword twice. Can any one please help cat > t.txt a d c > cat > t.ksh while read... (4 Replies)
Discussion started by: Ravindra Swan
4 Replies

10. Shell Programming and Scripting

Grep multi line with keyword ?

Hello Everyone, i need to grep specific keyword in a file. i want need solution to output. example file.txt 03-08-2019 21:02:20,938 ::: Recieve Data From Amazon ::: 03-08-2019 21:02:20,938 IP : 192.168.1.1 | msg = Your confirmation code for 'Verify phone number' is xxxxx | sno =... (2 Replies)
Discussion started by: ooilinlove
2 Replies
NXDIR(1)						      General Commands Manual							  NXDIR(1)

NAME
nxdir - inspect a NeXus file non interactively SYNOPSIS
nxdir filename [options] DESCRIPTION
nxdir allows to retrieve the structure and/or data of a NeXus file. OPTIONS
About NXdir -h|--help Print help information and exit. --version Print version information and exit. Node Selection -p path Path inside the file to look in. This can be absolute or relative and can be class or name of a given field. To anchor the path at the beginning or end place a "/" there. To specify that a level must exist, but the name or class can be anything, use a dot ".". To specify that any number of levels can exist, use a star "*". Output Control -o/+o Print (or not) the value of selected nodes, if possible. Defaults to false (+o). -l|--max-array Change the number of elements that are printed for arrays. Forces "-o". (default: 10) -t|--tree-mode value Sets the formatting of the tree. Allowed values are: script, multi, tree. Default is script. --path-mode value Select whether paths are written with names or classes. Allowed values are: name, class, both. Default is name. --data-mode value How data is printed. Allowed value is script --printline value How data is printed with respect to tree. Allowed values is single --write-data filename Select a file to write out selected NXdata to. --dump filename Generate a binary dump of the selected node. SEE ALSO
nxbrowse(1) http://www.nexusformat.org AUTHOR
nxdir was originally written by P. F. Peterson <petersonpf@ornl.gov> This manual page was written by Tobias Richter <Tobias.Richter@diamond.ac.uk> and may be used by others. June 2010 NXDIR(1)
All times are GMT -4. The time now is 11:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy