Sponsored Content
Operating Systems AIX Print nth previous line after match Post 302970045 by sushma123 on Thursday 31st of March 2016 11:56:40 PM
Old 04-01-2016
Print nth previous line after match

Please help me
print nth line after match

awk or sed one line command.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

return previous line for pattern match

Hi, Need some idea on file processing, I have file like below, Processing al sources ... ...No value found : CHECK. Completed comparing all sources. Comparing schedulers... Processing al targets ... ...No value found : From above I need to extract the line where "No value... (4 Replies)
Discussion started by: braindrain
4 Replies

2. Shell Programming and Scripting

Getting filename for Nth line pattern match

Hi, I have many scripts in particular directory. And few of the scripts have exit 0 in second line. Now i wanted to list out the scripts name which has the exit 0 in its second line I tried many options , but i can not get the filename along with the nth line pattern match :mad:. Can anyone... (14 Replies)
Discussion started by: puni
14 Replies

3. Shell Programming and Scripting

search pattern and replace x-y characters in nth line after every match

Hi, I am looking for any script which can do the following. have to read a pattern from fileA and copy it to fileB. fileA: ... ... Header ... ... ..p1 ... ... fileB: .... .... Header (3 Replies)
Discussion started by: anilvk
3 Replies

4. Shell Programming and Scripting

Delete line with match and previous line quoting/escaping problem

Hi folks, I've list of LDAP records in this format: cat cmmac.export.tmp2 dn: deviceId=0a92746a54tbmd34b05758900131136a506,ou=devices,ou=customer,ou=nl,o=upc cmmac: 00:13:11:36:a5:06 dn: deviceId=0a92746a62pbms4662299650015961cfa23,ou=devices,ou=customer,ou=nl,o=upc cmmac:... (4 Replies)
Discussion started by: tomas.polak
4 Replies

5. Shell Programming and Scripting

Print every nth line

Dear all, How to print every nth line. File like this: File input: 1 1 1 1 1 1 2 2 2 3 3 3 3 3 3 (3 Replies)
Discussion started by: attila
3 Replies

6. UNIX for Dummies Questions & Answers

Printing nth and n+1th line after a pattern match

Hi , I want to print the nth and n+1 lines from a file once it gets a pattern match. For eg: aaa bbb ccc ddd gh jjjj If I find a match for bbb then I need to print bbb as well as 3rd and 4th line from the match.. Please help..Is it possible to get a command using sed :) (6 Replies)
Discussion started by: saj
6 Replies

7. Shell Programming and Scripting

Print nth line in a file

Bash/Oracle Linux 6.4 A basic requirement. How can I get nth line of a file printed ? Can I use grep in this case ? Example: In the below file, 12th line is "Kernel parameter check passed for rmem_max" . I just want the 12 line to be printed. # cat sometext.txt Kernel version check... (2 Replies)
Discussion started by: John K
2 Replies

8. Shell Programming and Scripting

How to display when nth line match a pattern?

Hi All, I have sample of listing as following Database 2 entry: Database alias = PXRES Database name = PXRES Local database directory = /db2/data1/db2phnx Database release level = d.00 Comment ... (3 Replies)
Discussion started by: ckwan
3 Replies

9. Shell Programming and Scripting

How to delete the previous line after pattern match?

Team, I am writing a shell script to perform few health checks of the system, where I need to delete the previous line in the text file after pattern match using sed (or) awk. Could you please help me out on this? For example, <td> <td style=color:green align=center> </td> </tr>... (6 Replies)
Discussion started by: Nagaraj R
6 Replies

10. UNIX for Beginners Questions & Answers

awk or sed to print the character from the previous line after the regexp match

Hi All, I need to print the characters in the previous line just before the regular expression match Please have a look at the input file as attached I need to match the regular expression ^ with the character of the previous like and also the pin numbers and the output file should be like... (6 Replies)
Discussion started by: kshitij
6 Replies
DICT(7) 						 Miscellaneous Information Manual						   DICT(7)

NAME
dict - dictionary browser SYNOPSIS
dict [ -k ] [ -d dictname ] [ -c command ] [ pattern ] DESCRIPTION
Dict is a dictionary browser. If a pattern is given on the command line, dict prints all matching entries; otherwise it repeatedly accepts and executes commands. The options are -d dictname Use the given dictionary. The default is oed, the second edition of the Oxford English Dictionary. A list of available dictionar- ies is printed by option -d?. -c command Execute one command and quit. The command syntax is described below. -k Print a pronunciation key. Patterns are regular expressions (see regexp(6)), with an implicit leading and trailing Patterns are matched against an index of headwords and variants, to form a `match set'. By default, both patterns and the index are folded: upper case characters are mapped into their lower case equivalents, and Latin accented characters are mapped into their non-accented equivalents. In interactive mode, there is always a `current match set' and a `current entry' within the match set. Commands can change either or both, as well as print the entries or infor- mation about them. Commands have an address followed by a command letter. Addresses have the form: /re/ Set the match set to all entries matching the regular expression re, sorted in dictionary order. Set the current entry to the first of the match set. !re! Like /re/ but use exact matching, i.e., without case and accent folding. n An integer n means change the current entry to the nth of the current match set. #n The integer n is an absolute byte offset into the raw dictionary. (See the A command, below.) addr+ After setting the match set and current entry according to addr, change the match set and current entry to be the next entry in the dictionary (not necessarily in the match set) after the current entry. addr- Like addr+ but go to previous dictionary entry. The command letters come in pairs: a lower case and the corresponding upper case letter. The lower case version prints something about the current entry only, and advances the current entry to the next in the match set (wrapping around to the beginning after the last). The upper case version prints something about all of the match set and resets the current entry to the beginning of the set. p,P Print the whole entry. h,H Print only the headword(s) of the entry. a,A Print the dictionary byte offset of the entry. r,R Print the whole entry in raw format (without translating special characters, etc.). If no command letter is given for the first command, H is assumed. After an H, the default command is p. Otherwise, the default command is the previous command. FILES
/lib/oed/oed2 /lib/oed/oed2index Other files in /lib. SEE ALSO
regexp(6) SOURCE
/sys/src/cmd/dict BUGS
A font with wide coverage of the Unicode Standard should be used for best results. (Try /lib/font/bit/pelm/unicode.9.font.) If the pattern doesn't begin with a few literal characters, matching takes a long time. The dictionaries are not distributed outside Bell Labs. DICT(7)
All times are GMT -4. The time now is 06:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy