Sponsored Content
Full Discussion: awk help string capture
Top Forums Shell Programming and Scripting awk help string capture Post 302878604 by jaydeep_sadaria on Saturday 7th of December 2013 08:59:32 AM
Old 12-07-2013
awk help string capture

Dear All

My input file as under. From it I want op fine as mention below. Kindly help. I use below code but not help.

code:
Code:
awk -F"  " '{print $2}'

ip file:
Code:
"BSCJNGR_IPA17_C" 030 131207 1305 RXOCF-353 PBD011_BGIL   BOTH AC FAULTY
"BSCJNGR_IPA17_C" 991 131207 1637 RXOCF-224 NAV001_BGIL   SITE ON BATTERY
"BSCJNGR_IPA17_C" 150 131207 1704 RXOCF-105 GKA001_BGIL   SITE ON BATTERY RECTIFIRE FAIL
"BSCJNGR_IPA17_C" 276 131207 1742 RXOCF-78 KEN001_BGIL   SITE ON BATTERY RECTIFIRE FAIL LOW BATTERY VOLTAGE BOTH AC FAULTY
"BSCJNGR_IPA17_C" 290 131207 1746 RXOCF-67 JAM034_BGIL   MAINS FAIL
"BSCJUN1_IPA17_C" 372 131207 1320 RXOCF-84 SPS001_BGIL   SITE ON BATTERY DG ON RECTIFIRE FAIL

op:
Code:
131207 1305  PBD011_BGIL   BOTH AC FAULTY
131207 1637  NAV001_BGIL   SITE ON BATTERY
131207 1704  GKA001_BGIL   SITE ON BATTERY RECTIFIRE FAIL
131207 1742 KEN001_BGIL   SITE ON BATTERY RECTIFIRE FAIL LOW BATTERY VOLTAGE BOTH AC FAULTY
131207 1746 JAM034_BGIL   MAINS FAIL
131207 1320 SPS001_BGIL   SITE ON BATTERY DG ON RECTIFIRE FAIL

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to capture the service name from tnsnames.ora and create connect string

ghkjkjoj (4 Replies)
Discussion started by: chetankelvin
4 Replies

2. Shell Programming and Scripting

Need to capture certain text from a string in a different file

Hi, I wanted to know how i could accomplish this in a script using ksh. Lets say there is a file called test.dat and it has a certain input like below : . . Hi = 56 Hi = 67 . . 1 record(s) selected Now i need to capture the numbers after the = sign and store them in a... (3 Replies)
Discussion started by: Siddarth
3 Replies

3. UNIX for Advanced & Expert Users

capture data from matched string/line

Hi, I have a query as follows : suppose I am matching a string in a file say "start from here" and I want to pick up 'n' number of lines () from the matched string. Is there any way to do that ? 1) going forward I want to do this for every match for the above string 2) or limit this to... (2 Replies)
Discussion started by: sumoka
2 Replies

4. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies

5. Shell Programming and Scripting

Capture string contained on a line?

Hello All, I'm working on a script that runs the wget command on a list of IP Address in order to capture the data at that address' index.html. That part works fine to get the HTML code at that address but the data I'm trying to pull out is on a line containing a BUNCH of code for an HTML... (4 Replies)
Discussion started by: mrm5102
4 Replies

6. Shell Programming and Scripting

How to capture a string enclose by a pattern within a file?

Hi all, My file :test.txt just like this: ........................... From: 333:123<sip:88888888888@bbbb.com To: <sip:123456@aaaaa.com ......................... I want a script to capture the string between sip: & @ Expect output: 88888888888 123456 Please help! (4 Replies)
Discussion started by: Alex Li
4 Replies

7. Shell Programming and Scripting

String capture from ip file

Dear All From below mention input file I want op file as mention. Kindly help. IP file: "BSCGNR4_IPA17_C" 329 140119 0717 RXOCF-105 KJO001_BASC_NG AC FAULTY DG ON DOOR OPEN Needed OP: 140119 0717 KJO001_BASC_NG AC FAULTY DG ON DOOR OPEN Note that string mark in red as variable in... (3 Replies)
Discussion started by: jaydeep_sadaria
3 Replies

8. Shell Programming and Scripting

How to capture string below a line?

Hi, I need to collect IP address of all servers (more than 300). One way is put it in for loop and run nslookup for that servers list, but there are multiple fields in output. (tty/dev/pts/13): bash: 1011 > nslookup vplssor04 Server: 10.58.115.34 Address: 10.58.115.34#53 Name: ... (7 Replies)
Discussion started by: solaris_1977
7 Replies

9. Shell Programming and Scripting

Script to capture string in a log file

Dear all, I have a log file to be analysed. this log file contains vaiours lines of code starting with date timestamp. if my search string is exception then that resepective log statement starting from the date is required. example: 2014/10/01 16:14:44.459|>=|E|X|19202496|2832|... (5 Replies)
Discussion started by: shravee
5 Replies

10. Shell Programming and Scripting

Awk:String search more than one time and capture OP

Dear All During one of mine script developemnt i am stuch at one sub part. Requiremnt is as below kindly help me. IP file: 2015-02-28 10:10:15 AL M UtranCell UtranCell=RTE001X (unavailable) 2015-02-28 10:10:15 AL M UtranCell UtranCell=RTE001Y (unavailable) 2015-02-28 10:10:15 AL M... (6 Replies)
Discussion started by: jaydeep_sadaria
6 Replies
APMD(8)                                                                                                                                    APMD(8)

NAME
apmd - Advanced Power Management (APM) daemon SYNOPSIS
apmd [ -TVWciqv ] [ -P program ] [ -T seconds ] [ -c seconds ] [ -p percent ] [ -v level ] [ -w percent ] DESCRIPTION
apmd is an monitoring daemon for the Advanced Power Management (APM) subsystem. The APM subsystem consists of power-management hardware, firmware usually referred to as the APM BIOS and a driver in the operating system kernel. The daemon can execute a program (usually a shell script) when events are reported by the APM subsystem, and will log, via syslogd(8), certain changes in power status. When the available battery power becomes very low it can alert the user. When the APM subsystem notifies the daemon of a pending suspend or standby request, apmd will run a proxy program, log the event, sync(2) data to the disk and then tell the APM subsystem to continue its operation. Preparations for power management events are made mainly by the proxy program specified using the -P option. The proxy program is invoked with one or two arguments: start Invoked when the daemon starts. stop Invoked when the daemon stops. standby ( system | user ) Invoked when the APM subsystem reports that standby has been initiated. The second parameter indicates whether firmware ("system") or software ("user") was the originator of the event. The "standby" mode conserves power but leaves the machine able to respond almost immediately to user activity. Most laptops can't stay in standby mode on battery power for more than a few hours or a day. Normally, nothing special needs to be done to prepare for "standing by". suspend ( system | user ) Invoked when the APM subsystem reports that suspension has been initiated. The second parameter indicates whether firmware ("sys- tem") or software ("user") was the originator of the event. The "suspend" mode aggressively conserves power. Usually this involves shutting off power to all devices except the CPU core and memory, which are put into a very low power mode. Most laptops can stay suspended, using battery power alone, for several days. ("Hibernation" is a kind of super-suspend, where all that state is written to disk and the machine uses no power. Hibernation is treated like suspension by the APM subsystem.) Before suspending, PCMCIA devices may need to be disabled using cardctl(8), and some modular device drivers may need to be unloaded if they have not been designed to support power management. resume ( suspend | standby | critical ) Invoked when the APM subsystem reports that computer has resumed normal operation. The second parameter indicates the kind of event from which the system is resuming. (A "critical" suspend is a suspension that the APM subsystem performs in an emergency. Some kernels do not pass this event to user space. If apmd receives the event, it acknowledges the event and exits immediately without logging or running the proxy program.) When resuming, PCMCIA devices may need to be re-enabled using cardctl(8), and some modular drivers may need to be reloaded. Note that in the case of a critical suspend, the system state may not have been completely saved. change power Invoked when the APM subsystem reports a change in power status, such as a switch from mains to battery power. change battery Invoked when the APM subsystem reports that the charge of one or more batteries is low. A few minutes of battery power may remain. change capability Invoked when the APM subsystem reports some change in power management capabilities. It may have been caused by operation of a set- up utility, or by the installation or removal of devices. apmd emits various messages, most of which are self-explanatory. Battery status log entries contain three fields, separated by commas. The first field indicates how full the battery is as a percentage of its capacity. The second field indicates whether the battery is charging, not charging, or discharging. When possible, apmd adds in parentheses its estimate of the rate of charging or discharging. The third field indicates how much time the battery can or could be used to power the computer. This information is provided by the APM sub- system. When possible, apmd adds in parentheses its own estimate of the battery life (if discharging) or of the time required to charge the battery fully (if charging). OPTIONS
-P program, --proxy program Specifies the proxy program to execute when events are received. See above for information about the arguments supplied to this program. -T [seconds] , --proxy-timeout [seconds] Sets a time-out for the proxy. Without this option (or with this option and a negative argument) apmd waits indefinitely for the proxy to finish. If the proxy enters an infinite loop or wait then the machine may appear to have crashed. If this option is given a positive integer argument then apmd will wait only that many seconds for the proxy to finish, after which it will log a warning, kill the proxy, and continue processing the event. The default is 30 seconds. -V, --version Prints the version of the apmd program. -W, --wall In addition to logging low battery status (as determined either by the -w level or by the firmware) using syslog(2), apmd will, given this option, also use wall(1) to alert all users. This is most useful if syslogd(8) is not set up to write ALERT messages to all users. If both methods are used, more warnings will be made during the critical time period. -c [seconds] , --check [seconds] Controls how many seconds to wait for an event. Without this option (or with this option and a negative argument) apmd waits indef- initely for an event. If this option is given a positive integer argument then apmd will wait only that many seconds before check- ing the battery level and possibly sending out a warning, calling the proxy or making an entry in the log. The default is 30 sec- onds. -i, --ignore-bios-battery-low Causes apmd to ignore a LOW BATTERY signal sent by the APM subsystem. Some firmware signals a low battery at the wrong time. Note that LOW BATTERY events may still be generated by apmd itself based on the warning level. -p percent, --percentage percent Controls how often the battery status is logged. A new line is printed each time the battery content changes by percent_change if logging is enabled. The default is 5. Use a value greater than 100 to disable periodic logging of the battery level. -q, --quiet-bios-battery-low Causes apmd not to generate a warning when a LOW BATTERY signal is received from the APM subsystem. The firmware on some machines produces an audible warning when power is about to be used up, so an extra warning may not be needed. -v [level] , --verbose [level] The daemon can generate messages of varying degrees of unimportance. Each message is assigned one of the priority levels defined for the syslogd(8) subsystem, ranging from 0 (EMERG, least unimportant) to 7 (DEBUG, most unimportant). This option sets the threshold level above which messages are suppressed. Without an argument it increments the threshold by 1, thus making apmd more verbose. The default is 5 (NOTICE). -w percent, --warn percent When the battery is not being charged and the battery content falls below the specified percent of capacity, and no such event has yet occurred in the current discharge cycle, apmd will log a warning at the ALERT log level to syslog(2) and generate a LOW BATTERY event. If the -W or --wall option was given, the daemon will also use wall(1) to alert all users of impending doom. The default warning level is 10. Use a negative value to disable this feature. -h, --help Causes apmd to print a brief command summary and exit. BUGS
This daemon supports all APM events described in the APM BIOS specification version 1.2; however it fails to support some of the advanced features of APM 1.2, such as reporting the conditions of multiple batteries. (Multiple batteries are currently treated as if they were just one large one.) Estimates of charge and discharge rates and times can be very inaccurate. There is no interaction yet with ACPI support as found in newer PC hardware. FILES
/dev/apm_bios Device through which apmd communicates with the Linux APM driver. /proc/apm APM driver status information /etc/apmd_proxy Proxy program that is run if none is specified. /etc/apm/apmd_proxy Proxy program that is run if none is specified. (Debian) AUTHOR
This program was written by Rik Faith (faith@cs.unc.edu) and may be freely distributed under the terms of the GNU General Public License. There is ABSOLUTELY NO WARRANTY for this program. The current maintainer is Avery Pennarun (apenwarr@worldvisions.ca). SEE ALSO
apm(1), xapm(1), cardctl(8), syslogd(8). January 2004 APMD(8)
All times are GMT -4. The time now is 01:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy