Hi,
I have this script, searches and sets variables, then searches and sets more variables from multiple files.
I'd need to debug it a bit.
Sometimes there is no results of command like `find | grep MAGT` or no variable has been found and script just hung on that or produces tons of garbage.
How could I get the condition for each command if some variable=0 or the file is empty, then print error message and terminate the script?
It should be easy task, but if someone can give me advice as well as if I can make syntax more simple it will be much appreciative.
Not clear what you are trying to do.
In all of these selected command lines the combination of `find | grep` or `find | egrep` just processes a syntax error from "find". The position in the command line suggests that you are trying to generate a filename (or filenames?).
Well I have bunch of log files, their names contains MAGT, DISP GWCO etc..., inside the files there is many lines like
task is to supply parameter refid=$1(-1323204051), then find another variable thread=0x22A0, then mbsync=1454490
I can then use variable $mbsync to search in another file for another variables and when I get all variables needed I will then display all important lines with variables on the end of the script.
> /tmp/resRA-$$ generated random file, it's used for sed to filter the actual variable, this method may be difficult, but I've never had any problem with it, but if there is any easier way I will be happy to use it.
I wanted as well to make script managing different input variables like supply GWID instead of the refid and do the same procedure, but don't know how to do it. As a workaround I have another script with the same code but $1 is not refid but GWID.
Cheers
Last edited by Vitoriung; 09-18-2009 at 05:45 AM..
You might help us help you better if you could provide a better description of the problem you want to solve. I suggest that you:
Give us a psuedo code version of the algorithm you want to implement
Specifiy what the data files contain
note any special knowledge like you need the value of some field that appears in a line before you reach the line that tells you that you need it
specify what set of information completes a data set
specify the output format
specify what is fixed information and what is variable
OK I will try to give the info, hopefully it will help to understand my issue and it's not confusing too much:
1. Pseudo code version? I am not sure if I understand the question, I want to supply one fixed parameter and find all the other variables logically connected to that fixed parameter, all those exists in multiple log files.
2. Data files are the logs;contain the various data like debug information, system and connection messages. It's on the server processing emails and other items like PIM etc. and every day generates the logs as follows:
*GWSC* or *GWQM* - connects to email system checking for new emails
*MAGT* - connects to emails system to pickup the email
*DISP* - gets the email from *MAGT* and forwards to recipient
*GWCO* logs changes in the existing email system (reads, deletes, etc..)
3. All what I need to know is one input parameter. Depends on what one do I actually have.
Most of the time it's $refid, but it can be $IceID, or $tag
example of the lines I am looking for -
This is just the filtered output as it should be visible after successful searching.
Supplying the $refid shows what other parameters to search for to get the information from other files -
$refid needs $threadID=0x21CC to find MailSyncID and search for it in the *GWSC(QM)* file.
Problem is when the system fails and some items were not delivered, then I need the script to acknowledge me about it so I can see where is the point of the failure.
for example -
4. specify what set of information completes a data set - described in ad 3. ?
5. Output - I don't know what type of output can I have actually, suppose it could be e.g. XML file? Output would be fine as just text displayed in the console
6. fixed information is RefID in this script, variables are all the other ($mailsyncid, $tag, $ICEID ...) I'd like to have an option to supply any fixed information and search for relevant other variables. Typically I get $RefId or $ICEId when user reports the email hasn't been delivered.
How can I debug this script?
I want to know what it is doing or not doing?
#!/bin/bash
#
#
if ; then
# Do the thing you want before suspend here
echo "we are suspending." > /tmp/systemd_suspend_test.txt
elif ; then
# Do the thing you want after resume here
echo "and we are... (21 Replies)
Hi,
I am trying to get squid up and running using a redirector process, and every time I try to load a web page, squid fails miserably.
Can some one with perl and squid knowledge take a look at these codes and tell if something is wrong here.
#!/usr/bin/perl
#
$| = 1;
@endings = qw/... (0 Replies)
Hello,
is it possible to debug a script that is already running "on-demand"?
Somehow a command like "set -x" but once you've executed the script. And another one to disable debugging?
Thank you (0 Replies)
Hi I am relatively new in shell scripting Below is the code which i developed but for some reason, it keeps giving me error:
/apps/bss/BatchProg/at1/batch/scripts/ksh/TBATLC02.ksh: syntax error at line 41 : `then' unmatched
#!/usr/bin/ksh... (4 Replies)
Hi,
When i run the script ./script.sh sun, this give me no output, it should give me the list of file.
If i run the script without the argument it should send me echo inside usage().
What is the problem?
please help
-Adsi
#!/bin/sh
ROOT_PATH=/net/icebox/vol/local_images/spins... (2 Replies)
Hi All,
I have a script which is based on calculating current time
The script looks like this:
whenever i try to run the script it gives me error:Please advice wherther i have made mistake with if condition or with for loop??
The code :
set -x
#!/usr/bin/ksh
set -x... (7 Replies)
Hi all,
i have two simple questions here...
1. i want to know that how to debug the UNIX shell script?
2. is there any way to handling the exception in UNIX shell script like oracle exception handling?
Please provide me those details it would be great help/
Thanks and Regards,
MPS... (3 Replies)
Hi,
How can I debug an awk script?
I know that set -x can be used to debug a script. But this will not suite for awk scripts.
Can anyone help me?
Thanks in advance,
Chella (2 Replies)
I would like to extract the following fields from the text file attached. I copied the contents from a pdf file and pasted them into the text file so I can use awk to extract them. The layout is as listed below.
name1,name2,name3,name4,Title,designation,nationality,dob,
national ... (1 Reply)