Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Display lines after match is found within specified range Post 302722045 by nsuresh316 on Friday 26th of October 2012 09:15:31 AM
Old 10-26-2012
After using this code
Code:
/usr/xpg4/bin/awk    '/REF\*D9\*1001/ {B1=1}
        /REF\*D9\*1010/ {B1=0}
        /NM1\*85/ && B1 {getline;print}
       ' file

Expected Output
Code:
N3*123 ABC FLATS~
N3*223 ABC FLATS~
N3*323 ABC FLATS~
N3*423 ABC FLATS~
N3*523 ABC FLATS~
N3*623 ABC FLATS~
N3*723 ABC FLATS~
N3*823 ABC FLATS~
N3*923 ABC FLATS~
N3*023 ABC FLATS~

Actual Output
Code:
N3*223 ABC FLATS~
N3*323 ABC FLATS~
N3*423 ABC FLATS~
N3*523 ABC FLATS~
N3*623 ABC FLATS~
N3*723 ABC FLATS~
N3*823 ABC FLATS~
N3*923 ABC FLATS~
N3*023 ABC FLATS~

I got the output but N3 segment of 1001 is missing

Last edited by nsuresh316; 10-26-2012 at 10:27 AM..
 

10 More Discussions You Might Find Interesting

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

2. UNIX for Dummies Questions & Answers

awk display the match and 2 lines after the match is found.

Hello, can someone help me how to find a word and 2 lines after it and then send the output to another file. For example, here is myfile1.txt. I want to search for "Error" and 2 lines below it and send it to myfile2.txt I tried with grep -A but it's not supported on my system. I tried with awk,... (4 Replies)
Discussion started by: eurouno
4 Replies

3. UNIX for Dummies Questions & Answers

Display n lines before match found

I have a file with following data A B C D E F G H I K L M N and search pattern is G Expected output (3 Replies)
Discussion started by: nsuresh316
3 Replies

4. UNIX for Dummies Questions & Answers

Display n lines after match found and other line

I have a file like this DoctorName Address1 Address2 DOB InsuredName Address1 Address2 DOB PatientName Address1 Address2 DOB ClaimNo1 DoctorName Address1 Address2 DOB InsuredName (2 Replies)
Discussion started by: nsuresh316
2 Replies

5. UNIX for Dummies Questions & Answers

How to display lines by range specified?

My input file is N3*123 ABC FLATS~ REF*D9*10000000001~ N3*223 ABC FLATS~ REF*D9*10000000002~ N3*323 ABC FLATS~ REF*D9*10000000003~ N3*423 ABC FLATS~ REF*D9*10000000004~ N3*523 ABC FLATS~ REF*D9*10000000005~ N3*623 ABC FLATS~ REF*D9*10000000006~ N3*723 ABC FLATS~ REF*D9*10000000007~ N3*823... (2 Replies)
Discussion started by: nsuresh316
2 Replies

6. Shell Programming and Scripting

Grep range of lines to print a line number on match

Hi Guru's, I am trying to grep a range of line numbers (based on match) and then look for another match which starts with a special character '$' and print the line number. I have the below code but it is actually printing the line number counting starting from the first line of the range i am... (15 Replies)
Discussion started by: Kevin Tivoli
15 Replies

7. Shell Programming and Scripting

Display lines of two date range from syslog file

Hi Guys, I want to display lines from Solaris syslog file but with 2 dates range. I have some similar solution (https://www.unix.com/shell-programming-scripting/39293-grep-log-file-between-2-dates-4.html) which works fine but as you know syslog has different date format (Jan 22) so this is not... (1 Reply)
Discussion started by: prashant2507198
1 Replies

8. Shell Programming and Scripting

Grep multiple exact match, do not display lines

Hi, Need help to grep the following from a file x. I just want to grep exact match not lines and not partial word. CONFSUCCESS CONFFAIL CONFPARTIALSUCCESS >cat x xczxczxczc zczczcxx CONFSUCCESS czczczcczc czxxczxzxczcczc CONFFAIL xczxczcxcczczc zczczczcz CONFPARTIALSUCCESS czczxcxzc ... (4 Replies)
Discussion started by: rajeshwebspere
4 Replies

9. UNIX for Dummies Questions & Answers

awk - (URGENT!) Print lines sort and move lines if match found

URGENT HELP IS NEEDED!! I am looking to move matching lines (01 - 07) from File1 and 77 tab the matching string from File2, to File3.txt. I am almost done but - Currently, script is not printing lines to File3.txt in order. - Also the matching lines are not moving out of File1.txt ... (1 Reply)
Discussion started by: High-T
1 Replies

10. Shell Programming and Scripting

Display match or no match and write a text file to a directory

The below bash connects to a site, downloads a file, searches that file based of user input - could be multiple (all that seems to work). What I am not able to figure out is how to display on the screen match found or no match found" and write a file to a directory (C:\Users\cmccabe\Desktop\wget)... (4 Replies)
Discussion started by: cmccabe
4 Replies
FS_LSMOUNT(1)						       AFS Command Reference						     FS_LSMOUNT(1)

NAME
       fs_lsmount - Reports the volume for which a directory is the mount point.

SYNOPSIS
       fs lsmount -dir <directory>+ [-help]

       fs ls -d <directory>+ [-h]

DESCRIPTION
       The fs lsmount command reports the volume for which each specified directory is a mount point, or indicates with an error message that a
       directory is not a mount point or is not in AFS.

       To create a mount point, use the fs mkmount command. To remove one, use the fs rmmount command.

OPTIONS
       -dir <directory>+
	   Names the directory that serves as a mount point for a volume. The last element in the pathname provided must be an actual name, not a
	   shorthand notation such as one or two periods ("." or "..").

       -help
	   Prints the online help for this command. All other valid options are ignored.

OUTPUT
       If the specified directory is a mount point, the output is of the following form:

	  '<directory>' is a mount point for volume '<volume name>'

       where

       o   A number sign ("#") precedes the <volume name> string for a regular mount point.

       o   A percent sign ("%") precedes the <volume name> string for a read/write mount point.

       o   A cell name and colon (":") follow the number or percent sign and precede the <volume name> string for a cellular mount point.

       The fs mkmount reference page explains how the Cache Manager interprets each of the three types of mount points.

       If the directory is a symbolic link to a mount point, the output is of the form:

	  '<directory>' is a symbolic link, leading to a mount point for volume
	  '<volume name>'

       If the directory is not a mount point or is not in AFS, the output reads:

	  '<directory>' is not a mount point.

       If the output is garbled, it is possible that the mount point has become corrupted in the local AFS client cache. Use the fs flushmount
       command to discard it, which forces the Cache Manager to refetch the mount point.

EXAMPLES
       The following example shows the mount point for the home directory of user "smith":

	  % fs lsmount /afs/abc.com/usr/smith
	  '/afs/abc.com/usr/smith' is a mount point for volume '#user.smith'

       The following example shows both the regular and read/write mount points for the ABC Corporation cell's "root.cell" volume.

	  % fs lsmount /afs/abc.com
	  '/afs/abc.com' is a mount point for volume '#root.cell'

	  % fs lsmount /afs/.abc.com
	  '/afs/.abc.com' is a mount point for volume '%root.cell'

       The following example shows a cellular mount point: the State University cell's "root.cell" volume as mounted in the ABC Corporation cell's
       tree.

	  % fs lsmount /afs/stateu.edu
	  '/afs/stateu.edu' is a mount point for volume '#stateu.edu:root.cell'

PRIVILEGE REQUIRED
       The issuer must have the "l" (lookup) permission on the ACL of the root directory of the volume that houses the file or directory named by
       the -dir argument, and on the ACL of each directory that precedes it in the pathname.

SEE ALSO
       fs_flushmount(1), fs_mkmount(1), fs_rmmount(1)

COPYRIGHT
       IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved.

       This documentation is covered by the IBM Public License Version 1.0.  It was converted from HTML to POD by software written by Chas
       Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell.

OpenAFS 							    2012-03-26							     FS_LSMOUNT(1)
All times are GMT -4. The time now is 02:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy