Sponsored Content
Top Forums Shell Programming and Scripting Grep can't match expected but output all Post 302878033 by Corona688 on Wednesday 4th of December 2013 10:33:57 AM
Old 12-04-2013
It's likely printing to stderr, not stdout, which bypasses grep completely. Redirect stderr into stdout.

Code:
service --status-all 2>&1 |grep dbus

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help to grep for a title match and then make some queries after the match

Here is the sample of my file address.txt Address 1 1234 Drive way New Orleans, LA Zipcode :- 12345 Address 2 4567 Spring way Chicago, IL Zipcode :- 67890 I would like to grep for an Address title (Ex :- Address 2) , then get its zipcode and echo both in a single line. Ex :- ... (3 Replies)
Discussion started by: leo.maveriick
3 Replies

2. Shell Programming and Scripting

awk not generating the expected output

Hi, I am presently stuck in a csv file. INPUT CSV baseball,NULL,8798765,Most played baseball,NULL,8928192,Most played baseball,NULL,5678945,Most played cricket,NOTNULL,125782,Usually played cricket,NOTNULL,678921,Usually played EXPECTED OUTPUT CSV ... (7 Replies)
Discussion started by: scripter12
7 Replies

3. Shell Programming and Scripting

Output is not comming as expected

Hi All, I am in middle of one script. I want output in the form of xls file. There are 4 fields - user name, email Id, full name, date of birth. I want these details to get in seperate columns. But, i am getting it in the single cell and as like a paragraph.:mad: Please suggest me some... (8 Replies)
Discussion started by: Agupte
8 Replies

4. Shell Programming and Scripting

Not getting expected output

Hi I have written below script to get the data in table form. #!/bin/sh echo "File Name\tType" for i in *; do echo "$i\t\c" if ; then echo "directory" elif ; then echo "symbolic link" elif ; then echo "file" else echo "unknown" fi donehowever i am getting output in different way... (3 Replies)
Discussion started by: scriptor
3 Replies

5. UNIX for Dummies Questions & Answers

Grep not giving expected results

Version: RHEL 5.8 I am doing a grep of the piped output from ps command as shown below. I am grepping for the pattern ora_dbw* . But, in the result set I am seeing strings with ora_dbr* as well like ora_dbrm_SDLM1DAS3 as shown below. Any idea why is this happening ? $ ps -ef | grep... (6 Replies)
Discussion started by: John K
6 Replies

6. UNIX for Dummies Questions & Answers

Grep -B used with -f? (Searching a file using a list of terms, output is lines before each match)

(1 Reply)
Discussion started by: Twinklefingers
1 Replies

7. Shell Programming and Scripting

awk output not what was expected

Good Moring, I am currently reading about awk in a manual and following the examples using the oratab file. My system is SOLARIS 10 I think I am getting strange behavior judging by what the book says to do and what I am getting with my little program. Here is my program: grep -v oratab |... (4 Replies)
Discussion started by: bdby
4 Replies

8. Shell Programming and Scripting

For loop not giving expected output

#cat /tmp/input old_array old_dev new_dev new_array 0577 008AB 01744 0125 0577 008AC 01745 0125 0577 008AD 005C8 0125 0577 008AE 005C9 0125 0577 008AF 005CA 0125 0577 008B0 005CB 0125 0577 008B1 005CC 0125 cat test.sh #!/bin/ksh... (4 Replies)
Discussion started by: mbak
4 Replies

9. Shell Programming and Scripting

awk not giving the output expected

Hello, I am practising awk and decided to compare two columns and print the result of the comparison as third column i/p data c1,c2,c3 1,a,b 1,b,b i am trying to compare the last two columns and if they match I am trying to print match else mismatch(Ideally i want that as a last column... (5 Replies)
Discussion started by: mkathi
5 Replies

10. Shell Programming and Scripting

Grep output to file result not as expected

Hi Gurus, I run command grep ABC file1 > file2 against below file. I got all ABC_xxx in one line in file2. I expect to get multiple lines in file2. If I print result in screen, the result is expected. thanks in advance My os is SunOS 5.10 Generic_150400-64 sun4v sparc sun4v ABC_123 XXXXX... (2 Replies)
Discussion started by: green_k
2 Replies
acpid(8)						      System Manager's Manual							  acpid(8)

NAME
acpid - Advanced Configuration and Power Interface event daemon SYNOPSIS
acpid [options] DESCRIPTION
acpid is designed to notify user-space programs of ACPI events. acpid should be started during the system boot, and will run as a back- ground process, by default. It will open an events file (/proc/acpi/event by default) and attempt to read whole lines which represent ACPI events. If the events file does not exist, acpid will attempt to connect to the Linux kernel via the input layer and netlink. When an ACPI event is received from one of these sources, acpid will examine a list of rules, and execute the rules that match the event. acpid will ignore all incoming ACPI events if a lock file exists (/var/lock/acpid by default). Rules are defined by simple configuration files. acpid will look in a configuration directory (/etc/acpi/events by default), and parse all regular files with names that consist entirely of upper and lower case letters, digits, underscores, and hyphens (similar to run-parts(8)). Each file must define two things: an event and an action. Any blank lines, or lines where the first character is a hash ('#') are ignored. Extraneous lines are flagged as warnings, but are not fatal. Each line has three tokens: the key, a literal equal sign, and the value. The key can be up to 63 characters, and is case-insensitive (but whitespace matters). The value can be up to 511 characters, and is case and whitespace sensitive. The event value is a regular expression (see regcomp(3)), against which events are matched. The action value is a commandline, which will be invoked via /bin/sh whenever an event matching the rule in question occurs. The command- line may include shell-special characters, and they will be preserved. The only special characters in an action value are "%" escaped. The string "%e" will be replaced by the literal text of the event for which the action was invoked. This string may contain spaces, so the commandline must take care to quote the "%e" if it wants a single token. The string "%%" will be replaced by a literal "%". All other "%" escapes are reserved, and will cause a rule to not load. This feature allows multiple rules to be defined for the same event (though no ordering is guaranteed), as well as one rule to be defined for multiple events. To force acpid to reload the rule configuration, send it a SIGHUP. In addition to rule files, acpid also accepts connections on a UNIX domain socket (/var/run/acpid.socket by default). Any application may connect to this socket. Once connected, acpid will send the text of all ACPI events to the client. The client has the responsibility of filtering for messages about which it cares. acpid will not close the client socket except in the case of a SIGHUP or acpid exiting. For faster startup, this socket can be passed in as stdin so that acpid need not create the socket. In addition, if a socket is passed in as stdin, acpid will not daemonize. It will be run in foreground. This behavior is provided to support systemd(1). acpid will log all of its activities, as well as the stdout and stderr of any actions, to syslog. All the default files and directories can be changed with commandline options. OPTIONS
-c, --confdir directory This option changes the directory in which acpid looks for rule configuration files. Default is /etc/acpi/events. -C, --clientmax number This option changes the maximum number of non-root socket connections which can be made to the acpid socket. Default is 256. -d, --debug This option increases the acpid debug level by one. If the debug level is non-zero, acpid will run in the foreground, and will log to stderr, in addition to the regular syslog. -e, --eventfile filename This option changes the event file from which acpid reads events. Default is /proc/acpi/event. -n, --netlink This option forces acpid to use the Linux kernel input layer and netlink interface for ACPI events. -f, --foreground This option keeps acpid in the foreground by not forking at startup. -l, --logevents This option tells acpid to log information about all events and actions. -L, --lockfile filename This option changes the lock file used to stop event processing. Default is /var/lock/acpid. -g, --socketgroup groupname This option changes the group ownership of the UNIX domain socket to which acpid publishes events. -m, --socketmode mode This option changes the permissions of the UNIX domain socket to which acpid publishes events. Default is 0666. -s, --socketfile filename This option changes the name of the UNIX domain socket which acpid opens. Default is /var/run/acpid.socket. -S, --nosocket filename This option tells acpid not to open a UNIX domain socket. This overrides the -s option, and negates all other socket options. -p, --pidfile filename This option tells acpid to use the specified file as its pidfile. If the file exists, it will be removed and over-written. Default is /var/run/acpid.pid. -v, --version Print version information and exit. -h, --help Show help and exit. EXAMPLE
This example will shut down your system if you press the power button. Create a file named /etc/acpi/events/power that contains the following: event=button/power action=/etc/acpi/power.sh "%e" Then create a file named /etc/acpi/power.sh that contains the following: /sbin/shutdown -h now "Power button pressed" Now, when acpid is running, a press of the power button will cause the rule in /etc/acpi/events/power to trigger the script in /etc/acpi/power.sh. The script will then shut down the system. DEPENDENCIES
acpid should work on any linux kernel released since 2003. FILES
/proc/acpi/event /dev/input/event* /etc/acpi/ /var/run/acpid.socket /var/run/acpid.pid /var/lock/acpid BUGS
There are no known bugs. To file bug reports, see AUTHORS below. SEE ALSO
regcomp(3), sh(1), socket(2), connect(2), systemd(1), acpi_listen(8), kacpimon(8) AUTHORS
Ted Felix (www.tedfelix.com) Tim Hockin <thockin@hockin.org> Andrew Henroid acpid(8)
All times are GMT -4. The time now is 03:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy