10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
I have the following script, and I want to assign the output ($10 and $5) from awk to N and L:
grdinfo data.grd | awk '{print $10,$5}'| read N L
output from gridinfo data.grd is: data.grd 50 100 41 82 -2796 6944 0.016 0.016 3001 2461. where N and L is suppose to be 3001 and 100. I use... (8 Replies)
Discussion started by: geomarine
8 Replies
2. UNIX for Beginners Questions & Answers
Hello All,
Hope you're doing well !
I am trying below command to be passed in a shell script, header_date_14 is a variable and $1 is the name of a file I intend to pass as a command line argument, however command line argument is not being accepted.
header_date_14=$(m_dump... (8 Replies)
Discussion started by: ektubbe
8 Replies
3. Shell Programming and Scripting
I am reading lines from a file that contain a number sign (#) before a three or four digit number:
#1043
#677
I can remove the '#' and get just the number. However, I then want to assign that number to a variable and use it as part of a path further on in my program:
/mydir/10/1043 for... (5 Replies)
Discussion started by: KathyB148
5 Replies
4. Shell Programming and Scripting
I see a millioin ways to do this with echo, but what I wan to do is assign a variable the "nth" character of an incoming parameter to a ksh script.
$1 will be "pia"
I need to assign the first character to stmttype. (10 Replies)
Discussion started by: klarue
10 Replies
5. Programming
Hi,
I am unable to assign value zero to my variable which is defined as unsigned char.
typedef struct ABCD
{
unsigned char abc;
unsigned char def;
unsigned char ghi;
} ABCD;
typedef ABCD *PABCD;
In my Por*C code, i assign the values using memcpy like below
... (3 Replies)
Discussion started by: gthangav
3 Replies
6. Shell Programming and Scripting
hello all
i request you to give the solution for the following problem..
I want read the text file.and print the contents character by character..like if the text file contains google means..i want to print
g
go
goo
goog
googl
google
like this Using unix Shell scripting...
without using... (1 Reply)
Discussion started by: samupnl
1 Replies
7. Shell Programming and Scripting
Dear All,
we have a command output which looks like :
Total 200 queues in 30000 Kbytes
and we're going to get "200" and "30000" for further process. currently, i'm using :
numA=echo $OUTPUT | awk '{print $2}'
numB=echo $OUTPUT | awk '{print $5}'
my question is : can I use just one... (4 Replies)
Discussion started by: tiger2000
4 Replies
8. Shell Programming and Scripting
Hi Anyone can help me??i writing a perl using array to translate ip address to the hostname my script are below.this line print "$myhost{$ipaddr}\n"; blank :mad:hostname dint come out:mad::mad:
#!/usr/local/bin/perl
@ipaddr=("192.1.168.2","172.25.1.13","129.1.2.5");
%myhost = { 192.1.168.2... (4 Replies)
Discussion started by: netxus
4 Replies
9. Shell Programming and Scripting
Hey,
I'm trying to print the first four characters of the hostname of a computer.
I can get it from using:
hostname -s | sed 's/...........$//'"
but this is when I know how many characters are in the computer name.
I dont understand why some like:
hostname -s | sed '/..../p'
wont... (7 Replies)
Discussion started by: yxian
7 Replies
10. Shell Programming and Scripting
How...
can I read input by a user character by cahracter. And assign each character from the string to a variable?
Any help would be greatly appreciated!
Thank you! (1 Reply)
Discussion started by: Tek-E
1 Replies
UPSC(8) NUT Manual UPSC(8)
NAME
upsc - example lightweight UPS client
SYNOPSIS
upsc -l | -L [host]
upsc ups [variable]
upsc -c ups
DESCRIPTION
upsc is provided as a quick way to poll the status of a UPS server. It can be used inside shell scripts and other programs that need UPS
data but don't want to include the full interface.
OPTIONS
-l host
List all UPS names configured at host, one name per line. The hostname defaults to "localhost". You may optionally add a colon and a
port number.
-L host
As above, list all UPS names configured at host, including their description provided by the remote upsd(8) from ups.conf(5). The
hostname defaults to "localhost". You may optionally add a colon and a port number to override the default port.
-c ups
Lists each client connected on ups, one name per line.
ups
Display the status of that UPS. The format for this option is upsname[@hostname[:port]]. The default hostname is "localhost".
variable
Display the value of this variable only. By default, upsc retrieves the list of variables from the server and then displays the value
for each. This may be useful in shell scripts to save an additional pipe into grep.
EXAMPLES
To list all variables on an UPS named "myups" on a host called "mybox", with upsd(8) running on port 1234:
$ upsc myups@mybox:1234
battery.charge: 100.0
battery.voltage: 13.9
battery.voltage.nominal: 13.6
. . .
To list the UPSes configured on this system, along with their descriptions:
$ upsc -L
apc: Back-UPS 500
ppro2: Patriot Pro II
To retrieve the status for all UPSes connected to mybox, using Bourne-shell syntax:
$ for UPS in `upsc -l mybox:1234`; do
upsc $UPS ups.status
done
To list clients connected on "myups":
$ upsc -c myups
127.0.0.1
::1
192.168.1.2
DIAGNOSTICS
upsc will either print a list of UPS names, a list of all supported variables and their values on the UPS, or an error message. If you
receive an error, make sure you have specified a valid UPS on the command line, that upsd(8) is really running on the other host and that
no firewalls are blocking you.
HISTORY
Earlier versions of this program used the upsfetch library and UDP sockets to talk to upsd. This version of upsc uses the new upsclient
library, which only talks TCP. This is why upsct no longer exists.
SEE ALSO
upsd(8)
INTERNET RESOURCES
The NUT (Network UPS Tools) home page: http://www.networkupstools.org/
Network UPS Tools 05/21/2012 UPSC(8)