Sponsored Content
Full Discussion: Tricky GREP question..
Top Forums UNIX for Dummies Questions & Answers Tricky GREP question.. Post 302599621 by Mordaris on Friday 17th of February 2012 04:27:53 PM
Old 02-17-2012
Question Tricky GREP question..

I have some large login files that I need to extract (user)@(server) from. Where it gets tricky is that there is usually more than one '@' sign on each line(although it does have a leading space if it's not part of the (user)@(server) string), I need only the (user)@(server) section, I need only unique occurrences, AND I need to drop the ones where the (server) is an IP address. Here are a few sample lines from the file:

Code:
2012-02-17 00:07:49 ABC[generic04]: [KJEHKJNSEDS0] jdhws@bosun01: Request connection
2012-02-17 00:07:49 ABC[generic04]: [KJEHKJNSEDS0] jdhws@bosun01: connection closed
2012-02-17 00:07:49 ABC[generic02]: [KJJEHWSEDS0] hicks@bosun02: Request connection
2012-02-17 00:07:49 ABC[generic04]: [KJEHKJNSEDS0] star@192.168.1.254: Reset busy
2012-02-17 00:07:49 ABC[generic04]: jdhws@bosun01: [KJEHKJNSEDS0]  Connection running

The output I would need the command to generate from these lines would be:
Code:
jdhws@bosun01
hicks@bosun02

Can it be done?

Last edited by methyl; 02-17-2012 at 06:36 PM.. Reason: please use code tags
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

Tricky File Permission Question

I'm trying to answer the following question about file permissions in Unix. Consider a file with the following permissions: rwx---r-- I am not the owner of this file, but I am a member of the group of this file. My question is: do I have read access to this file? I thought... (3 Replies)
Discussion started by: Hook
3 Replies

2. Windows & DOS: Issues & Discussions

Tricky one...

Here's my problem: I have a laptop running Windows XP Pro with no internal CD or Floppy drives. I want to install Linux on it. I don't care about the Windows XP Pro installation, in fact I would like to install Linux over the entirety of the HD. However I cannot boot from any external CD drive... (1 Reply)
Discussion started by: saabir
1 Replies

3. Shell Programming and Scripting

Tricky script question

Hi, I'm in the midst of writing a UNIX script that sftp's files to an external host and am stuck with a problem. The problem is that the files created on my server as a order number that correlates to a sequence of directories on the remote host which is where the file should be ftp'ed. ... (3 Replies)
Discussion started by: budrito
3 Replies

4. UNIX for Dummies Questions & Answers

Tricky Quotation Question

Hi, I am at a point in my script where I defined the number of the command line parameter I would like to set a variable equal to: parameter_number=14 I would then like to set a variable equal to the correct parameter: variable=$parameter_number The issue here is that {} is required... (2 Replies)
Discussion started by: msb65
2 Replies

5. Shell Programming and Scripting

Tricky sed or awk question

Hello everyone, unfortunately I am no unix nor scripting guru, which is why I am asking for help here. I am trying to reformat a .csv file using sed or awk which has the following format: a,b,C-D-E,f,g h,i,J,k,l m,n,O-P-Q-R-S,t,u v,w,X-Y,z,a It's basically a 5-field text file which has an... (7 Replies)
Discussion started by: awayand
7 Replies

6. Shell Programming and Scripting

Another tricky sed or awk question

This post is in reference to https://www.unix.com/shell-programming-scripting/137977-tricky-sed-awk-question-post302428154.html#post302428154 I am trying to go the opposite direction now: I have the following file: a,b,C,f,g a,b,D,f,g a,b,E,f,g h,i,J,k,l m,n,O,t,u m,n,P,t,u m,n,Q,t,u... (3 Replies)
Discussion started by: awayand
3 Replies

7. Solaris

Tricky egrep

Hi folks! My first post here. I'm working on a script that retrieves a range of files from a list depending on a range of time. UPDATE: I've seen it could be difficult to read all this thing, so I'll make a summarize it.. How come I do this and take a result.. grep "..\:.." lista.new |... (4 Replies)
Discussion started by: kl0x
4 Replies

8. Shell Programming and Scripting

grep variable with tricky content

Hello, i have this issue: text="-8x7YTVNk2KiuY-PWG5zzzjB-zzw" string=-8x7YTVNk2KiuY-PWG5zzzjB-zzw echo $text | grep -v \'$string\' -8x7YTVNk2KiuY-PWG5zzzjB-zzw echo \'$string\' '-8x7YTVNk2KiuY-PWG5zzzjB-zzw' ..and ofcourse if I do like this : echo $text | grep -v $string grep: invalid... (5 Replies)
Discussion started by: black_fender
5 Replies

9. Shell Programming and Scripting

Tricky recursive removal (find with grep)

Tricky one: I want to do several things all at once to blow away a directory (rm -rf <dir>) 1) I want to find all files recursively that have a specific file extension (.ver) for example. 2) Then in that file, I want to grep for an expression ( "sp2" ) for example. 3) Then I want to... (1 Reply)
Discussion started by: jvsrvcs
1 Replies

10. Shell Programming and Scripting

Tricky BASH quoting question

I have some data files that I can identify by a certain pattern in the names using find. Every one of those data files has an XML file associated with it (can be multiple data files per XML file). The XML file is always up one directory from the data file(s) in a folder calledRun##### -... (12 Replies)
Discussion started by: Michael Stora
12 Replies
VOS_LISTADDRS(1)					       AFS Command Reference						  VOS_LISTADDRS(1)

NAME
vos_listaddrs - Displays all VLDB server entries SYNOPSIS
vos listaddrs [-uuid <uuid of server>] [-host <address of host>] [-printuuid] [-cell <cell name>] [-noauth] [-localauth] [-verbose] [-encrypt] [-noresolve] [-help] vos lista [-u <uuid of server>] >>> [-h <address of host>] [-p] [-c <cell name>] [-noa] [-l] [-v] [-e] [-nor] [-he] DESCRIPTION
The vos listaddrs command displays all of the server entries from the Volume Location Database (VLDB). An entry is created as the File Server initializes and registers the contents of its /var/lib/openafs/local/sysid file in the VLDB. OPTIONS
-host <address of host> Rather than displaying all the server entries, display only server entries for the specified host. This will show all multihomed addresses registered by that File Server in the VLDB. -uuid <uuid of server> Rather than displaying all the server entries, display only server entries for the File Server with the specified UUID. This will show all multihomed addresses registered by that File Server in the VLDB and also allows mapping a File Server UUID to its address. -printuuid Prints the UUID of server entries in addition to the registered addresses. The -printuuid option is available in OpenAFS versions 1.4.5 or later and 1.5.8 or later. -cell <cell name> Names the cell in which to run the command. Do not combine this argument with the -localauth flag. For more details, see vos(1). -noauth Assigns the unprivileged identity anonymous to the issuer. Do not combine this flag with the -localauth flag. For more details, see vos(1). -localauth Constructs a server ticket using a key from the local /etc/openafs/server/KeyFile file. The vos command interpreter presents it to the Volume Server and Volume Location Server during mutual authentication. Do not combine this flag with the -cell argument or -noauth flag. For more details, see vos(1). -verbose Produces on the standard output stream a detailed trace of the command's execution. If this argument is omitted, only warnings and error messages appear. -encrypt Encrypts the command so that the operation's results are not transmitted across the network in clear text. This option is available in OpenAFS versions 1.4.11 or later and 1.5.60 or later. -noresolve Shows all servers as IP addresses instead of the DNS name. This is very useful when the server address is registered as 127.0.0.1 or when dealing with multi-homed servers. This option is available in OpenAFS versions 1.4.8 or later and 1.5.35 or later. -help Prints the online help for this command. All other valid options are ignored. OUTPUT
The output displays all server entries from the VLDB, each on its own line. If a file server machine is multihomed, all of its registered addresses appear on the line. The first one is the one reported as a volume's site in the output from the vos examine and vos listvldb commands. The VLDB records IP addresses, and the command interpreter has the local name service (either a process like the Domain Name Service or a local host table) translate them to hostnames before displaying them. If an IP address appears in the output, it is not possible to translate it. The existence of an entry does not necessarily indicate that the machine that is still an active file server machine. To remove obsolete server entries, use the vos changeaddr command with the -remove argument. EXAMPLES
The following command displays the VLDB server entries in the ABC Corporation cell: % vos listaddrs sv5.abc.com sv1.abc.com sv2.abc.com afs2.abc.com sv6.abc.com The following command displays the VLDB server entry and UUID for host sv5.abc.com in the ABC Corporation cell: % vos listaddrs -p -ho sv5.abc.com UUID: 000c5aff-8246-1699-96-c4-437b5a45aa77 sv5.abc.com PRIVILEGE REQUIRED
None SEE ALSO
fs_uuid(1), sysid(5), vos(1), vos_changeaddr(1), vos_examine(1), vos_listvldb(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 VOS_LISTADDRS(1)
All times are GMT -4. The time now is 07:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy