Sponsored Content
Full Discussion: awk command issue
Top Forums UNIX for Beginners Questions & Answers awk command issue Post 302984046 by RudiC on Thursday 20th of October 2016 07:14:42 AM
Old 10-20-2016
You can't stuff all statements from a structured, indented script into a single line just one after the other and expect it to work; at least semicolons have to be added to separate the statements, and a logics check should be done afterwards as well.

But, you are right, a / was missing in the command. I updated the post accordingly, thanks.

Besides that, not having any data to work upon, above proposal was an approximation to be tested and adapted - it was a starting point to show the concept.
BTW, your specification in post#1 did not match what was coded in your script. Starting with a bad specification will never end with good results.

Last edited by RudiC; 10-20-2016 at 08:21 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

command line arg issue with awk

Hi friends, I am trying to pass input from command line and trying to print that column values. (FYI: I am using ksh) My code goes like this... #!/bin/sh column=$1 awk '{print $'$column'}' I execute using command like this --> ls -l | file_name parameter Hope I am clear with my... (2 Replies)
Discussion started by: divzz
2 Replies

2. Shell Programming and Scripting

awk command in script gives error while same awk command at prompt runs fine: Why?

Hello all, Here is what my bash script does: sums number columns, saves the tot in new column, outputs if tot >= threshold val: > cat getnon0file.sh #!/bin/bash this="getnon0file.sh" USAGE=$this" InFile="xyz.38" Min="0.05" # awk '{sum=0; for(n=2; n<=NF; n++){sum+=$n};... (4 Replies)
Discussion started by: catalys
4 Replies

3. Shell Programming and Scripting

awk command issue

Hi, Please could someone advise the issue i have with my awk command ? my command is : export NUM_SCENARIOS=`awk -F= '!/^#/ && /NUM_SCENARIOS/{print $2}' /home/environment.properties` when I echo $NUM_SCENARIOS this comes back with : 100 10 The issue I have is, there is... (9 Replies)
Discussion started by: venhart
9 Replies

4. Shell Programming and Scripting

awk NR issue

Hi guys, i am trying to analyze a text file using awk and am not able to solve this issue. This is the piece of code that I have written BEGIN { ## Time to count MACs -> 5 seconds. TIME_LIMIT = 5; k = 50000; } ## For every line. { time_in_seconds = $1... (2 Replies)
Discussion started by: jamie_123
2 Replies

5. Shell Programming and Scripting

awk issue

Hi all, i am trying to use below command to see the output of hardware inventory, but i only see 2 first line no output of the command. awk '/Hardware/ {print $0}' XXX_result.txt Hardware inventory: Hardware inventory: any idea how to see whatever is under hardware inventory. i... (11 Replies)
Discussion started by: Jared
11 Replies

6. Shell Programming and Scripting

Variable value substitution issue with awk command issue

Hi All, I am using the below script which has awk command, but it is not returing the expected result. can some pls help me to correct the command. The below script sample.ksh should give the result if the value of last 4 digits in the variable NM matches with the variable value DAT. The... (7 Replies)
Discussion started by: G.K.K
7 Replies

7. Shell Programming and Scripting

For loop, awk command issue

limit.csv data -------------- 5600050 38Nhava 400077 27Bomay rate.txt data ------------- 38NhaVA 27BomaY 27Bomay below is my script: for i in `cat limit.csv` do b=`awk '{print $1}' $i` (4 Replies)
Discussion started by: p_satyambabu
4 Replies

8. Shell Programming and Scripting

awk command issue

Hi All, I have one file with below content Post1:uri Post2:urieop Post3:urtei I am trying to read each word seprated by delimiter with below command Value1=$(awk -F":" '{print $1}' $HSFILE) Value2=$(awk -F":" '{print $2}' $HSFILE) echo $Value1 echo $Value2 It is... (5 Replies)
Discussion started by: sharsour
5 Replies

9. Shell Programming and Scripting

Issue with awk command between Linux and Solaris

Hi, Here is the output using bash profile on Linux uptime 04:59:14 up 16 days, 4:48, 2 users, load average: 1.00, 1.00, 1.20 Here is the output using bash profile on Solaris uptime 4:00am up 84 day(s), 22:21, 3 users, load average: 0.09, 0.10, 0.12 Now,... (4 Replies)
Discussion started by: mohtashims
4 Replies

10. UNIX for Beginners Questions & Answers

Issue with awk command

I am new to unix.I have a requirement to get few fields from the log file as below. Log app9/cc-gr_base.log.2017-07-19.gz: hostname 1500523166993 NA:NA:NA http-nio-8080-exec-56 INFO Points balance from MIS for user with userId: 19651069, first name: DEREK RICHARD and last name: BOUDREAU is... (3 Replies)
Discussion started by: nextStep
3 Replies
powerman.dev(5) 						     powerman							   powerman.dev(5)

NAME
powerman.dev - PowerMan device specification files DESCRIPTION
PowerMan device specifications are rather wierd. For this reason, we suggest that you leave the writing of these scripts to the PowerMan authors. However, if you insist, here is how they work. Note: the authors do not guarantee that the PowerMan specification language will not change, however we are open to taking on maintenance of scripts submitted by PowerMan users. We can't guarantee that we'll be able to test new releases against all devices but we'll do our best not to break anything. NOTE: the best way to help us in this endeavor is to provide a ``simulator'' for your power controller and associated tests in the test subdirectory of the powerman source code. See the examples in that directory. By convention, device scripts are one device per file and are included as needed from a powerman.conf file, like this: include "/etc/powerman/icebox3.dev" A device script is surrounded by an outer block: specification "my_device_name" { # configuration settings # script blocks } The possible configuration settings are: timeout <float> (optional) device script timeout in seconds - applies to each script, the whole thing, not just a particular "expect". plug name { <string list> } (optional) if plug names are static, they should be defined. Any reference to a plug name in the powerman.conf must match one of the defined plug names. pingperiod <float> (optional) if a ping script is defined, and pingperiod is nonzero, the ping script will be executed periodically, every <float> sec- onds. Script blocks have the form: script <script_name> { # statements } Script blocks should all be grouped together with no config lines in between. Scripts are for performing particular operations such as power on, get power status, etc. The various script names are listed below. Those marked with [%s] are called with a plug name "argu- ment", which can be included in a send statements by including a %s (printf style). Warning: all the send strings are processed with printf and you can cause powermand to segfault if you include any printf tokens other than the appropriate zero or one %s. login Executed immediately on (re-)connect. If you need to login to the box, do it here. This is also a good place to descend through a first layer of menus. Caveat: % occurring in passwords must be escaped as %%. Caveat: occurs outside of client session so cannot be debugged with -T. A trick when debugging is to move this code into the status script temporarily so you can see what is going on. logout Executed prior to disconnect. Get device in a state so login script will work (though hopefully disconnecting will do that too). status_all, status[%s] Obtain plug state for all plugs or only the specified plug. When all plugs of a device are involved in a plug status query, the status_all script, if defined, will be called in preference to the status script; otherwise the status script is called for each plug. on_all, on_range[%s], on[%s] Power on all plugs, a range of plugs, or the specified plug. off_all, off_range[%s], off[%s] Power off all plugs, a range of plugs, or the specified plug. cycle_all, cycle_range[%s], cycle[%s] Power cycle all plugs, a range of plugs, or the specified plug. The intent of this command was to map to the RPC's cycle command; however, device script are increasingly implementing this in terms of a power off/delay/power so the off time can be controlled by the script. status_soft_all, status_soft[%s] Obtain soft power state for all plugs or only the specified plug. Soft Power refers to the "standby state" of the node. On means the node is powered up. Off means either the node is powered off at the plug or is powered on at the plug and in standby mode. This is really only useful on devices that include both a plug relay and a probe into the node attached to a non-standby power source. status_temp_all, status_temp[%s] Obtain temperature reading for all plugs or only the specified plug. Temperature is obtained by sampling a thermocouple in the node. Results are reported as a text string - not interpreted by Powerman beyond any regex chopping done by the script. status_beacon_all, status_beacon[%s] Obtain beacon state for all plugs or only the specified plug. Some RPC's include a way to flash a light on a node. beacon_on[%s] Flash beacon on the specified plug. beacon_off[%s] Clear beacon on the specified plug. reset_all, reset_range[%s], reset[%s] Reset all plugs, a range of plugs, or only the specified plug. Reset refers to signaling a motherboard reset butten header, not a plug cycle. Within a script, the following statements can be used: send <string> Send <string> to the device. delay <float> Pause script for <float> seconds. expect <string> <string> is compiled as a regular expression with regcomp(3). The regular expression is matched against device input. The script blocks until the regex is matched or the device timeout occurs (in which case the script is aborted). Upon matching, any parenthe- sized expressiones are assigned to variables: $1 for the first match, $2 for the second match, and so on. Warning: some implementa- tions of regex(3) silently fail if the regular expression exceeds available static storage. setplugstate [<string>|<regmatch>] <regmatch> [off=<string>] [on=<string>] Set the plug state. The first argument, if present, is the literal plug name or a <regmatch> from the previous expect which con- tains the plug name. If omitted, the plug name is presumed to be the script argument. The off and on strings are compiled regexes, which if matched by the second argument, result in the plug state being set to off or on. Yes we are applying regexes to reg- matches! If no off or on strings are provided, state will be unknown. ifoff, ifon Script statements enclosed in an ifon/ifoff block are conditional executed based on the state of the plug passed in as an argument. Ifon/ifoff blocks can only be used in single plug scripts that take an argument. foreachplug Script statements enclosed in a foreachplug block are executed iteratively with a %s argument defined for each target plug. Fore- achplug blocks can only be used in all plug scripts that take no argument. Script terminals are defined as follows: <float> decimal number - exponent forms not supported <string> Text surrounded by double quotes. May contain C style backslash-escaped characters, including three digit octal values, and most common backslash-escaped single character values. <string list> Multiple <string> values separated by white space. <script_name> Name of script (see above). <regmatch> Results of a parenthesized regular expression match are assigned to $1, $2, ... $N. FILES
/etc/powerman/*.dev ORIGIN
PowerMan was originally developed by Andrew Uselton on LLNL's Linux clusters. This software is open source and distributed under the terms of the GNU GPL. SEE ALSO
powerman(1), powermand(8), httppower(8), plmpower(8), vpcd(8), powerman.conf(5), powerman.dev(5), powerman-devices(7). http://sourceforge.net/projects/powerman powerman-2.3.5 2009-02-09 powerman.dev(5)
All times are GMT -4. The time now is 02:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy