Sponsored Content
Top Forums Shell Programming and Scripting Regex/egrep matching numbers in brackets Post 302540120 by jdveencamp on Tuesday 19th of July 2011 04:23:09 PM
Old 07-19-2011
Regex/egrep matching numbers in brackets

Experts:

I don't know that regular expressions will ever be easy for me, so if one of you guru's could help out, I'd appreciate it.

I'm trying to match a line in our syslog, but I can't figure out how to match a number inside a bracket. This is what I'm trying to match.
"Jul 16 00:01:34 webseal1 xinetd[5465]: Reading included configuration file"

This works well enough for me, but doesn't wildcard the PID
egrep -i "xinetd\[5465\]: Reading" filename

This is what I've tried. Obviously I'm not getting it.
egrep -i "xinetd\[\[0-9\]\]: Reading" filename
egrep -i "xinetd\[0-9\]: Reading" filename
egrep -i "xinetd\[[:digit:]\]: Reading" filename

And many other variants. I've done much googling to no avail. Could someone help me out?
Thanks in advance
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

REGEX: Matching Null?

I'm using the URL Regex feature of Squid for allowing sites via a list of regex strings to match allowed domains. The regex was actually copied from our previous proxy solution and it seemed to "just work". But, we've recently discovered that some domains (likely due to virtual hosts or host... (2 Replies)
Discussion started by: deckard
2 Replies

2. Shell Programming and Scripting

egrep regex

Hi, I have a file with some words divided into syllables by the character "|" (pipe). For example zu|ri|ghe|se.I would like a regex that matches all the words that are not divided in syllables.All the word that have no "|" pipe character.I have thought at $echo "zu|ri|ghe|se" | grep '' ... (7 Replies)
Discussion started by: and77
7 Replies

3. Shell Programming and Scripting

AWK regex to find only numbers

Hi guys I need to find both negative and positive numbers from the following text file. And i also dont need 0. 0 8 -7 -2268 007 -07 -00 -0a0 0a0 -07a0 7a00 0a0 Can someone please give a regex to filter out the values in red. I tried a few things in awk but it didnt work... (9 Replies)
Discussion started by: sridanu
9 Replies

4. Shell Programming and Scripting

regex question using egrep

Hi, i have a a bunch of directories that are always named with six lowercase alpha's and either one or two numeric's (but no more) so for example names could be qwerty1 qwerty9 qwerty10 qwerty67 I am currently using two pattern matches to capture these names echo $DIR |... (8 Replies)
Discussion started by: rethink
8 Replies

5. Shell Programming and Scripting

matching a regex using egrep not working

Hi, I'm trying to validate if a string matches a regular expression, but it is not working. Am I missing something? Do I need to scape any of the characters? if echo 'en-GB' | egrep '({1,8})(-{1,8})*' >/dev/null; then echo Valid value fi Thanks in advance (6 Replies)
Discussion started by: skrtxao
6 Replies

6. UNIX for Dummies Questions & Answers

egrep getting numbers only

Hello, I am kind of a noob with unix, so i'd like some help. I am trying to get some ip address with an nmap scan and then put from the result of the scan only the ip numbers this is an example Starting Nmap 5.21 ( Nmap - Free Security Scanner For Network Exploration & Security Audits )... (3 Replies)
Discussion started by: AscaL
3 Replies

7. Shell Programming and Scripting

Regex for HP egrep

I seem to be having an issue with an egrep command and I think its the way it is interpreting my regex. I have a test file.. ###FIND THESE### telnet /telnet `telnet -l` ###Dont FIND THESE### donotfindtelnet telnetdontfind Working Regex on Linux/Solaris egrep '\<(telnet|rcp)\>' $file ... (4 Replies)
Discussion started by: nitrobass24
4 Replies

8. Shell Programming and Scripting

Perl match multiple numbers from a variable similar to egrep

I want to match the number exactly from the variable which has multiple numbers seperated by pipe symbol similar to search in egrep.below is the code which i tried #!/usr/bin/perl my $searchnum = $ARGV; my $num = "148|1|0|256"; print $num; if ($searchnum =~ /$num/) { print "found"; }... (2 Replies)
Discussion started by: kar_333
2 Replies

9. Homework & Coursework Questions

Sed, matching nested brackets and deleting

1. The problem statement, all variables and given/known data: I have to write a script using sed, which delete everything between curly brackets and the brackets themself. The brackets might be nested. The input-file is: aaa { bbb ccc { ddd eee } fff { ... (2 Replies)
Discussion started by: FuzzyGnome
2 Replies

10. UNIX for Dummies Questions & Answers

Regex matching with grep -l

I am trying to find patterns in files using grep -l -e. I specifically am searching for abc. I want any file that has abc in it, but not just the letters abc. I am searching for a pattern a followed by b followed by c. I have tried egrep -l and also I have tried the following: grep -el... (2 Replies)
Discussion started by: newbie2010
2 Replies
XINETD(8)						      System Manager's Manual							 XINETD(8)

NAME
xinetd - the extended Internet services daemon SYNOPSIS
xinetd [options] DESCRIPTION
xinetd performs the same function as inetd: it starts programs that provide Internet services. Instead of having such servers started at system initialization time, and be dormant until a connection request arrives, xinetd is the only daemon process started and it listens on all service ports for the services listed in its configuration file. When a request comes in, xinetd starts the appropriate server. Because of the way it operates, xinetd (as well as inetd) is also referred to as a super-server. The services listed in xinetd's configuration file can be separated into two groups. Services in the first group are called multi-threaded and they require the forking of a new server process for each new connection request. The new server then handles that connection. For such services, xinetd keeps listening for new requests so that it can spawn new servers. On the other hand, the second group includes ser- vices for which the service daemon is responsible for handling all new connection requests. Such services are called single-threaded and xinetd will stop handling new requests for them until the server dies. Services in this group are usually datagram-based. So far, the only reason for the existence of a super-server was to conserve system resources by avoiding to fork a lot of processes which might be dormant for most of their lifetime. While fulfilling this function, xinetd takes advantage of the idea of a super-server to pro- vide features such as access control and logging. Furthermore, xinetd is not limited to services listed in /etc/services. Therefore, any- body can use xinetd to start special-purpose servers. OPTIONS
-d Enables debug mode. This produces a lot of debugging output, and it makes it possible to use a debugger on xinetd. -syslog syslog_facility This option enables syslog logging of xinetd-produced messages using the specified syslog facility. The following facility names are supported: daemon, auth, user, local[0-7] (check syslog.conf(5) for their meanings). This option is ineffective in debug mode since all relevant messages are sent to the terminal. -filelog logfile xinetd-produced messages will be placed in the specified file. Messages are always appended to the file. If the file does not exist, it will be created. This option is ineffective in debug mode since all relevant messages are sent to the terminal. -f config_file Determines the file that xinetd uses for configuration. The default is /etc/xinetd.conf. -pidfile pid_file The process ID is written to the file. This option is ineffective in debug mode. -dontfork Tells xinetd to stay in the foreground rather than detaching itself, to support being run from init or daemontools. This option automatically sets -stayalive (see below). -stayalive Tells xinetd to stay running even if no services are specified. -limit proc_limit This option places a limit on the number of concurrently running processes that can be started by xinetd. Its purpose is to prevent process table overflows. -logprocs limit This option places a limit on the number of concurrently running servers for remote userid acquisition. -version This option causes xinetd to print out its version information. -inetd_compat This option causes xinetd to read /etc/inetd.conf in addition to the standard xinetd config files. /etc/inetd.conf is read after the standard xinetd config files. -cc interval This option instructs xinetd to perform periodic consistency checks on its internal state every interval seconds. The syslog and filelog options are mutually exclusive. If none is specified, the default is syslog using the daemon facility. You should not confuse xinetd messages with messages related to service logging. The latter are logged only if this is specified via the configuration file. CONTROLLING XINETD
xinetd performs certain actions when it receives certain signals. The actions associated with the specific signals can be redefined by editing config.h and recompiling. SIGHUP causes a hard reconfiguration, which means that xinetd re-reads the configuration file and terminates the servers for ser- vices that are no longer available. Access control is performed again on running servers by checking the remote location, access times and server instances. If the number of server instances is lowered, some arbitrarily picked servers will be killed to satisfy the limit; this will happen after any servers are terminated because of failing the remote location or access time checks. Also, if the INTERCEPT flag was clear and is set, any running servers for that service will be termi- nated; the purpose of this is to ensure that after a hard reconfiguration there will be no running servers that can accept packets from addresses that do not meet the access control criteria. SIGQUIT causes program termination. SIGTERM terminates all running servers before terminating xinetd. SIGUSR1 causes an internal state dump (the default dump file is /var/run/xinetd.dump; to change the filename, edit config.h and recompile). SIGIOT causes an internal consistency check to verify that the data structures used by the program have not been corrupted. When the check is completed xinetd will generate a message that says if the check was successful or not. On reconfiguration the log files are closed and reopened. This allows removal of old log files. FILES
/etc/xinetd.conf default configuration file /var/run/xinetd.dump default dump file SEE ALSO
inetd(8), xinetd.conf(5), xinetd.log(5) http://cr.yp.to/daemontools.html AUTHOR
Panos Tsirigotis, CS Dept, University of Colorado, Boulder Rob Braun PRONUNCIATION
zy-net-d 14 June 2001 XINETD(8)
All times are GMT -4. The time now is 04:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy