Hi,
I'm trying to assign the output of a command to a variable and then concat it with another string, however, it keeps overwriting the original string instead of adding on to the end of the string.
Contents of test.txt --> This is a test
var1="`head -n 1 test.txt`"
echo $var1 (This is a... (5 Replies)
I am new to unix shell scripting.
I was trying to convert each lines in a file to upper case.
I know how to convert the whole file.
But here i have to do line by line.
I am getting it in the below mentioned script
#!/bin/bash
#converting lower to upper in a file
#tr "" "" <file1... (3 Replies)
When I run time -p <command>, it outputs:
real X.XX
user X.XX
sys X.XXwhere X.XX is seconds. How I can take just that first number output, the seconds of real time, and assign that to a variable? (9 Replies)
Hi guys!
I need to count the occurence of a certain pattern.
For example the pattern is PC.
the contents of the file sample.txt:
A PC
asdfgadfjkl
asdfa PC sadfaf
fdsPCasdfg
if i use grep -c PC sample.txt
it will display 3 as the number of occurence
how do i save that number to a... (1 Reply)
Hi All,
I have a fixed-width datafile from which i need to extract value/string starting from some position to the specified length in each of the lines.
awk '{print substr($0,x,y)}' datafile --- is working fine
but
awk 'BEGIN{a=0}{a=substr($0,x,y);print $a}' datafile ---is giving... (3 Replies)
Hi,
I'm using the bourn shell on a Sun Solaris Unix system. I am relatively new to UNIX scripting so please bear with me...
I'm having a couple issues:
1) I need to have a variable $FSIZE set with the output of a command each time the script runs. (the command looks for a file and... (8 Replies)
I have a script whose contents are as below
result= awk 's=100 END {print s }'
echo "The result is" $result
The desired output is
The result is 100
My script is running without exiting and i am also not getting the desired output.
Please help (5 Replies)
I'm converting decimal to integer with bc, and I'd like to assign the integer output from bc to a variable 'val'.
E.g. In the code below: If b is 5000.000, lines 6 and 8 will output:
5000
(5000.000+0.5)/1 | bc
I'd like val to take the value 5000 though, rather than 5000.000
Does someone... (3 Replies)
Hi I have a text file with 2 values and I am trying to assign each value to a variable and then write those to text files.
So if the textfile is data.txt with 2 values x and y
I want to assign mean=x, and stdev=y and then write these out in text files alongwith the id ($id has already been... (6 Replies)
Hello,
First of all, I'd like to say hello to all members of forum.
Can You please help me with the matter described below?
I am trying to fetch a data from the file to variable, I am doing this using below script:
returned=`tail -50 SapLogs.log | grep -i -E "Error|"`
echo $returned
... (2 Replies)
Discussion started by: jedzio
2 Replies
LEARN ABOUT DEBIAN
logfetch
LOGFETCH(1) General Commands Manual LOGFETCH(1)NAME
logfetch - Xymon client data collector
SYNOPSIS
logfetch CONFIGFILE STATUSFILE
DESCRIPTION
logfetch is part of the Xymon client. It is responsible for collecting data from logfiles, and other file-related data, which is then sent
to the Xymon server for analysis.
logfetch uses a configuration file, which is automatically retrieved from the Xymon server. There is no configuration done locally. The
configuration file is usually stored in the $BBHOME/tmp/logfetch.cfg file, but editing this file has no effect since it is re-written with
data from the Xymon server each time the client runs.
logfetch stores information about what parts of the monitored logfiles have been processed already in the $BBHOME/tmp/logfetch.status file.
This file is an internal file used by logfetch, and should not be edited. If deleted, it will be re-created automatically.
SECURITY
logfetch needs read access to the logfiles it should monitor. If you configure monitoring of files or directories through the "file:" and
"dir:" entries in client-local.cfg(5) then logfetch will require at least read-acces to the directory where the file is located. If you
request checksum calculation for a file, then it must be readable by the Xymon client user.
Do NOT install logfetch as suid-root. There is no way that logfetch can check whether the configuration file it uses has been tampered
with, so installing logfetch with suid-root privileges could allow an attacker to read any file on the system by using a hand-crafted con-
figuration file. In fact, logfetch will attempt to remove its own suid-root setup if it detects that it has been installed suid-root.
ENVIRONMENT VARIABLES
DU Command used to collect information about the size of directories. By default, this is the command du -k. If the local du-command
on the client does not recognize the "-k" option, you should set the DU environment variable in the $BBHOME/etc/hobbitclient.cfg
file to a command that does report directory sizes in kilobytes.
FILES
$BBHOME/tmp/logfetch.cfg
$BBHOME/tmp/logfetch.status
SEE ALSO xymon(7), hobbit-clients.cfg(5)Xymon Version 4.2.3: 4 Feb 2009 LOGFETCH(1)