This may just be a lack of experience talking, but I always assumed that when possible it was better to use a commands built in abilities rather than to pipe to a bunch of commands. I wrote a (very simple) script a while back that was meant to pull out a certain error code, and report back what... (4 Replies)
Hi ,
I would like to assign command (with pipe) output to a variable. The code is as follows. The goal of the code is to get the last folder folder with a particular name pattern.
myDate=`ls | grep 2009 | tail -1`
echo "myDate=" $myDate
However, in the presence of the pipe, the code... (3 Replies)
Hey all,
I've tried this for quite some time now and haven't figured it out... I was hoping one of you shell scripters could help a newbie out :)
I am trying to take the 1st parameter of my script and use it as the search pattern for my for loop
#!/usr/bin/sh
set -vx
REGEX=$1
... (3 Replies)
Hi,
I am trying to run this command:
ED_CMD="$Access_OPS $ED_Logs_Dir/access | $lgrep -v $Access_Err"
$lgrep $ED_CMD
However, i am getting an error "Failed to open |: Broken pipe at "
My question is how to put a pipe within a variable.
Thanks. John. (4 Replies)
Hi all,
Hope someone can help me out here.
I have this BASH script (see below)
My problem lies with the variable path.
The output of the command find will give me several fields. The 9th field is the path. I want to captured that and the I want to filter this to a specific level.
The... (6 Replies)
<tr><th align=right valign=top>Faulty_Part</th><td align=left valign=top>readhat version 6.0</td></tr> <tr><th align=right valign=top>Submit_Date</th><td align=left valign=top>2011-04-28 02:08:02</td></tr> .......(a long string)
I want to get all the field between "left valign=top>" and "... (2 Replies)
Hey fellas,
I wrote an script which its output is like this:
a 1 T
a 1 T
a 2 A
b 5 G
b 5 G
b 5 G
I wanna print $1 $2 and the total number of $2 value as the third column and after that $3. Sth like this:
a 1 2 T
a 2 1 A
b 5 3 G
I know how to do it with a given input... (4 Replies)
Hello all,
quick question:
is it possible to pass input into AWK BOTH with a pipe AND a file at the same time, something like this:
command .......|awk '.................' FILEIN > fileout
All I read says either one or the other, not both, is it at all possible?
And how would the... (2 Replies)
In the below awk to add a sort by smallest to largest should it be added after the END? Thank you :).
BEGIN {
FS="*"
}
# Read search terms from file1 into 's'
FNR==NR {
s
next
}
{
# Check if $5 matches one of the search terms
for(i in s) {
if($5 ~ i) {
... (4 Replies)
Dear UNIX forum members,
I am using macbook pro 13 (2015 edition) with MAC OS Mojave and am trying to write the shell script where when it is run through terminal it asks for an input (in the code below an input variable is domains) and then that input becomes capital letter or letters which... (3 Replies)
Discussion started by: Aurimas
3 Replies
LEARN ABOUT REDHAT
upslog
UPSLOG(8) Network UPS Tools (NUT) UPSLOG(8)NAME
upslog - UPS status logger
SYNOPSIS
upslog -h
upslog ups logfile interval [format]
DESCRIPTION
upslog is a daemon that will poll a UPS at periodic intervals, fetch the variables that interest you, format them, and write them to a
file.
The default format string includes variables that are supported by many common UPS models. See the description below to make your own.
OPTIONS -h Display the help message.
ups Monitor this UPS. The format for this option is [upsname@]hostname[:port].
logfile
Store the results in this file.
You can use - for stdout, but upslog will remain in the foreground.
interval
Wait this many seconds between polls.
Remember that a poll is not instantaneous, so it will slip back as the program runs. If you require tighter timing, you should
write your own logger using the upsclient library.
format The string to log, including variables from the UPS. Valid escapes within this string are:
%% - insert a single %
%TIME format% - insert the time with strftime formatting
%ETIME% - insert the number of seconds, ala time_t. This is now a 10 digit number.
%HOST% - insert the local hostname
%UPSHOST% - insert the host of the UPS being monitored
%PID% - insert the pid of upslog
%VAR varname% - insert the value of variable varname
The default format string is:
%TIME @Y@m@d @H@M@S% %VAR battpct% %VAR utility% %VAR loadpct% [%VAR status%] %VAR upstemp% %VAR acfreq%
SERVICE DELAYS
The interval value is merely the number given to sleep() after running through the format string. Therefore, a query will actually take
slightly longer than the interval depending on the speed of your system.
LOG ROTATION
upslog writes its pid to upslog.pid, and will reopen the log file if you send it a SIGHUP. This allows it to keep running when the log is
rotated by an external program.
SEE ALSO
Server:
upsd(8)
Clients:
upsc(8), upscmd(8), upsrw(8), upsmon(8)
Internet resources:
The NUT (Network UPS Tools) home page: http://www.exploits.org/nut/
NUT mailing list archives and information: http://lists.exploits.org/
Wed Oct 16 2002 UPSLOG(8)