I am looking to parse a text file output and set variables based on what is cropped from the parsing.
Below is my script I am looking to add this feature too.
All it does is scan a certain area of users directories for anyone using up more than X amount of disk space. It then writes to the output file and emails the output file when done to a number of people that is defined in the script.
I want it to also email the username found in the output file.
Below the script is a sample output of what is emailed.
--------------------------
output file data in /tmp/testing-results.log :
Basically, I need to read the output of /tmp/testing-results seen above, and crop out everything except the username "jdoe" and "bsmith" and "rguy" and set each one to a variable. Then just plugging in those variables to my mailx list with a domain name added.
This will then send the output to myname@mydomain, and also the output sent to each person/user "jdoe" "bsmith" ect...
I'm sure there are a million ways of doing this and would highly appreciate any suggestions of the read and parse of my output file /tmp/testing-results
Thanks in advance.
Last edited by Scott; 11-29-2012 at 12:12 AM..
Reason: Code tags, please
Running awk 10,000 times to handle 10,000 individual lines is like making 10,000 phone calls to say 10,000 words. If you're not going to use awk on more than one line at once you shouldn't bother using it at all. It's not a builtin. It's a programming language. Imagine running perl 10,000 times to handle 10,000 lines. Same problem.
You don't even need it. Ordinary shell operations will work here. Here's one method:
Hi Folks -
I was wondering if you could help convert batch code in Linux? For instance, I use the following piece of code in DOS to find a file/executable, and then the FULL path as a variable.
::-- If startMaxl.exe exists, set full path --::
for %%D in (c d e f g h i j k l m n o p q r s t... (4 Replies)
Greetings Experts,
I need to pass a parameter to ksh and the value is windows path eg: sh abc.txt C:\Users\chill3chee\Desktop
No matter I try with \ delimiter, still could not get this exact value assigned to the shell variable which was checked with echo. Tried with using... (2 Replies)
Can anyone suggest a workaround
zone_5.org='/qaz/qwe/path/tns.osn'
output
/home/bingo/XXX_script.sh: line 180: zone_5.org=/qaz/qwe/path/tns.osn: no parent
The path does not exist on the local machine, the allocation used to work till the server was upgraded.
Red Hat Enterprise Linux... (2 Replies)
Hello friends,
I need to set PATH variable for all HP-UX users. I tried to implement it using /etc/profile and /etc/sshrc both none of them work.
I don't see sshrc file anywhere.
Please advise!
TIA (4 Replies)
Hello All,
Hope you can understand my problem from the below code.
$ cat ~/.profile
PS1=`whoami`@`hostname`':$PWD
$ '
export PATH="$PATH:.:/logarchive/utility/util:/usr/sbin:"
$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:.:/usr/sbin:
$ echo $SHELL
/usr/bin/ksh
... (6 Replies)
I've noted that in order to use commands like ifconfig, I have to prefix the commands with the directory.
/etc/profile shows that the paths should be part of the PATH environment variable; any idea where the bug is?
:confused:
# /etc/profile
# System wide environment and startup... (1 Reply)
For some reason something has changing in my AIX environment where when I type:
ACLEDIT filename
...I get:
3002-104 acledit: EDITOR environment variable must be full pathname
I know I need to reset the EDITOR variables path to /usr/bin/vi but I can't remember the syntax anyone? (2 Replies)
Hi,
i know that this topic discussed for many times but although i had researched them i couldnt succeed in my problem.
i am following a step-by-step instruction guide and must do the following:
-------------
To ensure access, set the path PATH $ORACLE_HOME/perl/bin:$PATH and set the Perl... (2 Replies)
Hi,
How does the PATH and MANPATH environment variable get set?
I want to add "/opt/SUNWspro/bin" to the search path for all the users. Where can I access this variable.
I know in my home directory, depend on which shell I use, there are files such as .profile and .cshrc which I can edit to... (3 Replies)
I set my path environment variable in c shell, using the
syntax below
setenv PATH "${PATH}:/usr/local:/usr/local/bin"
and placed this in $HOME/.login
$HOME/.cshrc
and /etc/.login
/etc/.cshrc
but when I issued echo $PATH or set command
the output does not reflect changes made to... (5 Replies)