Sponsored Content
Top Forums Shell Programming and Scripting Adding grep'd results in a variable Post 302543064 by CougarMutt on Friday 29th of July 2011 09:38:41 AM
Old 07-29-2011
THANKS!!

That did it! Works like a charm.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to refine results of grep -p

I need help to further reduce the output shown below. I want to be able to only return the paragraph where the 'Database alias' is exactly equal to DBIHP. I do not want the other paragraphs being shown below. $ echo $dbalias DBIHP $ db2 list db directory|grep -p 'Database alias ... (2 Replies)
Discussion started by: priceb
2 Replies

2. UNIX for Dummies Questions & Answers

List grep results

Hi I need to search for matching strings in a database and I want to print out all files that matches in "detail", which means that I want the output to contain datum of last saving. I only get the grep function tp print the actual file names which is not enough since the database is to large... (14 Replies)
Discussion started by: slire
14 Replies

3. Shell Programming and Scripting

Grep results to store in a shell variable

I have the results of a grep with -n store in a shell variable ie VAR=`grep -n -e 'PATTERN' file` How ever I am missing the line breaks in the variable , How do I store the resualts of grep with many lines in to a variables. I want the varable should be the sawmway as we do the grep grep... (3 Replies)
Discussion started by: jojan
3 Replies

4. UNIX for Dummies Questions & Answers

putting grep -c results number in a variable

I want to display "no results found" if a grep search of a name that the user inputs is not found anywhere in a certain file, Right now I have this, but doesn't seem to work. Im not sure what to change. read name results=grep -c $name file if ; then echo "No results found." exit... (1 Reply)
Discussion started by: busdude
1 Replies

5. Shell Programming and Scripting

doing a for loop adding up the results

Hi there If I run a 'swap -l' on my solaris box, i get swapfile dev swaplo blocks free /dev/dsk/c1t0d0s1 54,65 8 67119560 65655144 /dev/dsk/c1t0d0s2 54,65 8 33119522 32655122 I wanted to run a for loop adding up the totals of each column 4 , excluding the... (2 Replies)
Discussion started by: hcclnoodles
2 Replies

6. Shell Programming and Scripting

Adding results of a find to an array

I'm trying to add the paths of all the xml files in certain directories to an array. I want to use the array later in my code. Anyway, for some reason this isn't working. Any help would be appreciated. Path_Counter=0 for result in "find * -name '*.xml'"; do XmlPath="$result" echo... (2 Replies)
Discussion started by: Fly_Moe
2 Replies

7. Shell Programming and Scripting

Grep no results

Hello guys, I have been looking around but can't find the answer to my problem: If the grep command displays no results, print "no results have been found" and increment x. But if the grep command find something, do nothing. if echo "no results have been found $x" x=`expr $x + 1 `... (3 Replies)
Discussion started by: Benou
3 Replies

8. UNIX for Dummies Questions & Answers

Adding previous results

Hi, I am trying to use awk to do the following: For a column: 5 3 4 2 7 I want to start with the first entry then add the second to the first, third to second ..etc: 5 8 12 14 21 (5 Replies)
Discussion started by: cosmologist
5 Replies

9. UNIX for Beginners Questions & Answers

Adding results up

Hi There Just created a .sql script and executes fine, it comes back with two lines of results, I was wondering is there a way of adding up the two results to get a round number. I tired wc -l but that didn't work. Many Thanks for your help psql -t -f... (3 Replies)
Discussion started by: simpsa27
3 Replies

10. Shell Programming and Scripting

I want to add a variable for the results from the formula of one variable and results of another var

Good morning all, This is the file name in question OD_Orders_2019-02-19.csv I am trying to create a bash script to read into files with yesterdays date on the file name while retaining the rest of the files name. I would like for $y to equal, the name of the file with a formula output with... (2 Replies)
Discussion started by: Ibrahim A
2 Replies
ACPITOOL(1)							   User Commands						       ACPITOOL(1)

NAME
acpitool - a Linux ACPI client, allowing you to query or set ACPI values SYNOPSIS
acpitool [ -aAbBcefFhjlmnosStTvVwWz ] DESCRIPTION
acpitool is a Linux ACPI client. It simply reads /proc/acpi or /sys/class entries and presents the output in a meaningfull, human-readable format. It provides a.o. information on battery status, AC adapter presence, thermal reading, etc. This command is most useful on laptops with an ACPI compliant BIOS and a Linux kernel, preferably from the 2.6 series, with ACPI enabled. Acpitool also allows the machine to be put into standby, if your laptop supports it. If your laptop is a Toshiba , it allows you to set the LCD brighness level and toggle the fan on/off. If you have an Asus laptop, it can also set the LCD brightness level, switch the LCD panel on or off, and control the mail led and wireless led. If you have an IBM Thinkpad laptop, it can once again set the LCD brightness level, and also eject the ultrabay device. OPTIONS
-a, --ac_adapter Show AC adapter presence -A Show supported Asus ACPI extensions (LCD brightness level, video out routing DSDT/acpi4asus info) -b Show battery status information, available batteries only. -B, --battery Show detailed battery status information, for all battery entries found. -c, --cpu Show CPU information (type, speed, PM capabilities, throttling states, c-state usage, frequency scaling). -e Show just about everything : more info on the batteries, ACPI version, kernel version, CPU, . . . -f, --fan Show fan status (shows fan info specific to Toshiba or IBM Thinkpad, if applicable). -F x Force the fan on (x=1) or switch back to auto mode (x=0). Works only on Toshiba laptops. The fan is switched off ONLY if it was forced on first, not if it was switched on automatically. Requires write access to /proc/acpi/toshiba/fan -h, --help Show help text. -j Eject Thinkpad ultrabay device. Requires write acces to /proc/acpi/ibm/bay -l x Set LCD brightness level to x, where x is in the range 0..7. Works only on Toshiba and IBM Thinkpad laptops. Requires write access to /proc/acpi/tochiba/lcd or /proc/acpi/ibm/brightness Illegal values for x will result in the value being set to either 0 or 7. -m x Switch the mail led on (x=1) or off (x=0). Works only on Asus laptops. Requires write access to /proc/acpi/asus/mled -n x Switch the wireless led on (x=1) or off (x=0). Works only on Asus laptops. Requires write access to /proc/acpi/asus/wled -o x Switch the LCD panel on (x=1) or off (x=0). Works only on Asus laptops. Requires write access to /proc/acpi/asus/lcd -s, --suspend to memory Put the machine into sleep state S3, if possible. Requires write access to /proc/acpi/sleep (kernel 2.4.x) or /sys/power/state (kernel 2.6.x) -S, --suspend to disk ? Put the machine into sleep state S4, if possible. Requires write access to /proc/acpi/sleep (kernel 2.4.x) or /sys/power/state (kernel 2.6.x) -t, --thermal Show thermal zone(s) information, including trip_points. -T, --Toshiba Show supported Toshiba ACPI extensions, currently being LCD brightness level, video out routing (what display is the video chip sending to) and fan status (on/off, forced or not). -v Show more verbose output when something is not found. Makes sense only when used together with other options. -V, --version Show acpitool version number and release date, then exit. -w Show the wakeup capable devices. (Available since ACPI 20040715, check your version). -W x Enable/disable wakeup capable device x. Run 'acpitool -w' to see valid numbers for x. Requires write access to /proc/acpi/wakeup -z x Set Asus LCD brightness level to x, where x is 0..15. Works only on Asus laptops. Requires write access to /proc/acpi/asus/brn REMARKS
This program absolutely requires a Linux kernel with ACPI support enabled. This program will not work without it. IBM Thinkpad support is part of the Linux kernel since kernel 2.6.10. Don't blame me if acpitool can't suspend your laptop : there are quite some problematic laptops out there. Check the acpi-bugzilla list if you don't believe me ;) Note that some options, like -F, -l , -j, -s, -W and -z, require write access to some of the /proc/acpi entries. This requires acpitool either to be run as root or either administrative measures must be taken, most likely by root, to allow ordinary users to write to these files. Creating a group for ACPI users and setting permissions accordingly comes to mind. Also note that older laptops (< 2000) often simply don't have ACPI support, they usually support APM only. BUGS
Let me know if you think you found one. FILES
/proc/acpi/... /proc/acpi/toshiba /proc/acpi/asus /proc/acpi/ibm /sys/power/state HOMEPAGE
http://freeunix.dyndns.org:8000/site2/acpitool.shtml AUTHOR
This program is written and maintained by David Leemans (davidleemans |at| scarlet |dot| be) and may be freely distributed under the terms of the GNU General Public License. There is ABSOLUTELY NO WARRANTY for this program. AcpiTool 0.5 24 Jul 2008 ACPITOOL(1)
All times are GMT -4. The time now is 11:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy