Sponsored Content
Top Forums UNIX for Dummies Questions & Answers printing only the middle word between two patterns Post 302351780 by tigta09 on Wednesday 9th of September 2009 01:13:19 PM
Old 09-09-2009
Thanks Scrutinizer, that worked great.

How would I modify this to print an IP address?
(FOO 10.192.12.102 BAR)

I thought it would work for anything in between two words but I see it only works for text. I tried

sed -e's/\<FOO\>.*\<\([.0-9]*\).*/\1/'

but it does not produce and results.

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep multiple patterns + the whole word only

Guys, i used egrep "pattern1|pattern2". But the whole word is searched. But i want the output if only the exact word is matched. i.e the output is got evenif a part of the pattern is matched. I tried the -w opion but its showing usage error. Please help me out on this one. please sent me... (2 Replies)
Discussion started by: meheretoknow
2 Replies

2. Shell Programming and Scripting

Grep with wildcard in middle of word

How can grep G.*schema give me the result: ${Gacntg_dt}""'"' doesn't G.*schema say give me an unlimited number of characters between G and schema? :confused: (3 Replies)
Discussion started by: danmauer
3 Replies

3. Shell Programming and Scripting

add a word in the middle

I have a file where in I need to add gctunit1/gtdivcompebb1/ after the = sign for example: gtfix31/gctunit_gtdivcompebb1/csclkswcompbypassstepgnnnh = gctunit1/gtdivcompebb1/csclkswcompbypassstepgnnnh (3 Replies)
Discussion started by: pitagi
3 Replies

4. Shell Programming and Scripting

grep middle word between two patterns

Hi, I'm currently working on a shell script to automate a backup check on oracle database. My requirement is to grep the words between two delimiters and pass on to a variable.. for ex I have following values in my log file... (DB_NAME), (163.24 25), (16/02/10 23:40), (COMPLETED), I want... (5 Replies)
Discussion started by: senthil3d
5 Replies

5. UNIX for Dummies Questions & Answers

Printing the lines using search patterns

Hi all , i need an help here.!!!! i have a file that contains /etc/passwd files from some servers. i need a script which search for presence of a user in the servers. like if i give 51144 to the script. the should be o/p Please help on this..... (4 Replies)
Discussion started by: sudharson
4 Replies

6. Windows & DOS: Issues & Discussions

Linux to Windows Printing: PDF starts printing from middle of page.

We are using Red Hat. We have a issue like this: We want to print from Linux, to a printer attached to a Windows machine. What we want to print is a PDF. It prints, but the printing starts from the middle of the page. In the report, there is no space at the top but still printing starts from the... (5 Replies)
Discussion started by: rohan69
5 Replies

7. Shell Programming and Scripting

printing patterns

I have the following file : 1 2 3 4 5 6 7 8 9 0 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 Write scripts to get the following outputs : A) 1 7 7 1 4 (11 Replies)
Discussion started by: pssooraj72
11 Replies

8. UNIX for Dummies Questions & Answers

Printing all the values in the middle of two columns

Hi, I have a tab delimited text file with three columns: Input: 1 25734 25737 1 32719 32724 1 59339 59342 1 59512 59513 1 621740 621745 For each row of the text file I want to print out all the values between the second and third columns, including them. The... (3 Replies)
Discussion started by: evelibertine
3 Replies

9. UNIX for Dummies Questions & Answers

Quick UNIX command to display specific lines in the middle of a file from/to specific word

This could be a really dummy question. I have a log text file. What unix command to extract line from specific string to another specific string. Is it something similar to?: more +/"string" file_name Thanks (4 Replies)
Discussion started by: aku
4 Replies

10. Shell Programming and Scripting

Help needed in excluding certain word patterns

Hi, I need help with following. I need to exclude words that match following patterns a. more than length 4 (example SBRAP) b. contains mixture uppercase and lower case regardless of the length (example GSpD) File contains COFpC MCHX SP SNFCA GEH SBRAP DGICA JPMpE WFCpP GSpD AXL... (5 Replies)
Discussion started by: jakSun8
5 Replies
NCDESTROY(1)						    BSD General Commands Manual 					      NCDESTROY(1)

NAME
ncdestroy -- Destroy kernel NFS credentials SYNOPSIS
ncdestroy [-v] [-P] [path [path...]] DESCRIPTION
ncdestroy invalidates the caller's kernel GSS credentials for any of the specified path's associated NFS mounts. If no paths are specified then all the caller's associated credentials for all NFS file systems are destroyed. When a nfs file system is mounted using a GSS mechanism (currently only Kerberos is supported) through the ``sec='' option or by the export specified on the server, the resulting session context is stored in a table for each mount. If the user decides to finish his or her session or chooses to use a different credential, then ncdestroy can be called to invalidate those credentials in the kernel. New credentials can be obtain (typically by calling kinit) and those credentials can be used when accessing the mount. The options are as follows: -v Be verbose and show what file system is being operated on and any resulting errors. -P If the trailing component resolves to a symbolic link do not resolve the link but use the current path to determine any associate NFS file system. EXAMPLES
If leaving for the day: $ kdestroy -A $ ncdestroy Lets say a user does $ kinit user@FOO.COM And through the automounter access a path /Network/Serves/someserver/Sources/foo/bar where the mount of /Network/Servers/some- server/Sources/foo was done with user@FOO.COM. $ cat /Network/Servers/someserver/Sources/foo/bar cat: /Network/Servers/someserver/Sources/foo/bar: Permission denied The user realizes that in order to have access on the server his identity should be user2@BAR.COM. So: $ kdestroy -A $ kinit user2@BAR.COM $ ncdestroy /Network/Servers/someserver/Sources/foo Now the local user can access bar NOTES
In the above example the user destroyed all credentials so the only credential to choose was new credential user2@BAR.COM. However, if accessing the server with user@FOO.COM was done by getting a cross realm TGT to obtain the service ticket nfs/some.server.fqdn@BAR.COM, then it won't be necessary to use kdestroy. The GSS infrastructure will prefer to use credentials in the same realm as the service. DIAGNOSTICS
The ncdestroy command will exit with 1 if any of the supplied paths don't exist. If all paths exist or no paths are given the exit status will be 0. SEE ALSO
kinit(1), kdestroy(1), mount_nfs(8) BUGS
There should be an option to kdestroy to destroy cached nfs contexts. BSD
December 10, 2012 BSD
All times are GMT -4. The time now is 02:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy