Hello Guys,
developing a monitoring shell script to have my queue depth count over mail .
here is the sample input file to the script which has all the queue names [ e.g QL.GVR.ATA.CACHE.01) and corresponding queue depth in the next line (e.g 4).
expected output is ...
Currently by grep and awk command iam able to get the depth stats but in very scattered format .
Currently by grep and awk command iam able to get the depth stats but in very scattered format .
Do it with the one command that commands them all: sed. (Short for: Saurons editor ;-)) )
Here it is. The sed-program is separated into its own file for readability, you can move it to the commandline as well. Remove the comments, sed won't undertand them):
Replace the tab character (line #6) by anything else if you want a different output format.
I hope this helps.
bakunin
Last edited by bakunin; 11-25-2018 at 10:29 AM..
Reason: corrected regexp, thanks to RudiC
Hi bakunin,
Thanks for your sed code, code gives the almost correct response .
two conditions have to add in your code
1. queues to be ignore if it QL.FAILED ****
e.g
2.couple of queues are extra check means if for those queue count is more than 300 then only it should appear in the output.
for example QL.PHGR limit needs to be validated by hardcode number defined somewhere in the script .if it crosesss the limit then only it should appear in the final output.
e.g
Hope iam not making it so complicated .
Moderator's Comments:
Please use CODE tags when displaying sample input, sample output, and code segments.
Last edited by Don Cragun; 11-30-2018 at 01:07 AM..
Reason: Add CODE and ICODE tags.
Thanks for your sed code, code gives the almost correct response .
two conditions have to add in your code
Sorry if this sounds a bit over-zealous, but: no. It gives a completely correct answer to an almost correctly stated problem. It is always a good idea to state the problem as clearly as possible and as complete as possible. If you start to say "i want a brick there" and then "and another brick there" you might end up eventually with a wall, but knowing you are after a wall in the end "use concrete" might have been a viable suggestion in first place.
Quote:
Originally Posted by wims
1. queues to be ignore if it QL.FAILED ****
e.g
ZFC8409: Display Queue details.
QUEUE(QL.FAILED.EMAIL.MIME)
OK, this is easy:
Quote:
Originally Posted by wims
2.couple of queues are extra check means if for those queue count is more than 300 then only it should appear in the output.
for example QL.PHGR limit needs to be validated by hardcode number defined somewhere in the script .if it crosesss the limit then only it should appear in the final output.
Now we have exactly this situation: knowing this condition makes sed a poorly suited tool for the problem. In fact it is possible to do arithmetic, integer comparisons and whatnot in sed (after all, it is a Turing-complete language), but it is, in fact too, very complicated to do so. Furthermore it is plainly ugly and - see the provided addition program in the link - not for the faint of heart. It is fun to stretch the limits of what can be done but in a professional environment you wouldn't want a colleague who churns out such monstrosities as seriously-meant solutions. It is great to be able to do double-somersaults but they are not a seriously suggestible means of getting from A to B.
I suggest going with RudiC's awk-script and add the additional conditions there.
There is another problem with your requirements:
Quote:
Originally Posted by wims
2.couple of queues are extra check[...]
OK, and: which ones?? Will this just be a fixed list, will they come from a file with queue names, is there some pattern (like the "any queue named QT.SOMETHING* is to be...") or anything else? Again: you want specific answers, please ask specific questions. Everything else is indeed wasting everybodies time. I have no problem at all spending time to come up with solutions and explain whatever needs to be explained but i hate going over the same problem in little variations again and again only to find out after the umpteenth iteration that what i did up to now was nonsense because i should have started on a completely different track.
I hope this helps.
bakunin
These 2 Users Gave Thanks to bakunin For This Post:
Thanks Rudie for the AWK code , as Bukinin suggested to have awk for validation , any advise from you on top of your provided code.
Quote:
1. queues to be ignore if it QL.FAILED ****
e.g
ZFC8409: Display Queue details.
QUEUE(QL.FAILED.EMAIL.MIME)
2.couple of queues are extra check means if for those queue count is more than 300 then only it should appear in the output.
for example QL.PHGR limit needs to be validated by hardcode number defined somewhere in the script .if it crosesss the limit then only it should appear in the final output.
Hi Guys,
I am stuck in between and seeking help here.
Requirement: A script that will run every morning which will connect to Mysql database and run the query to inform us about the holidays (it will also check if there were any holidays during last 2 business days). So the three queries are... (11 Replies)
Hi ,
i am generating some data by firing sql query with connecting to the database by my solaris box.
The below one should be the header line of my excel ,here its coming in separate row.
TO_CHAR(C. CURR_EMP_NO
---------- ---------------
LST_NM... (6 Replies)
Please provide script/commands to convert text file to HTML tabular format.
No need of styles and colours, just output and a heading in table is required.
Output file will be send via email and will be seen from outlook.
(script required without using awk).
output file content: (sar... (7 Replies)
Hi ,
I am purging two tables based on date.
In my script I am taking the count of the tables purging them and then taking the after counts. I need to mail the before and after counts of the two tables in a mail in table format as mentioned in the result section.
For Eg:
## Count of the... (14 Replies)
I have a grep command script which works fine and give the correct results but i wanted the output to be displayed in tabular format ? Is it possible to display
the output in tabular format and as well direct them to some file.
main script :
#!/usr/bin/bash
Start_Time=`date '+%m%d%y... (1 Reply)
How can i convert the below data to a simpler format :-
cat tabular.txt
User 1 Details :-
First Name = Tom
Middle Name =
Last Name = Hanks
Age = 40
Address =
User 2 details :-
First Name = Mike
Middle Name =
Last Name = Tyson
Age = 50
Address = (2 Replies)
Hi,
I have directory with multiple files from which i need to extract portion of specif lines and insert it in a new file, the new file will contain a separate columns for each file data.
Example:
I need to extract Value_1 & Value_3 from all files and insert in output file as below:
... (2 Replies)
Hi I am working on a script in which I am firing a query on database through Unix and getting the result set. I want to export that in an excel file. I am able to do so nut the result are exported horizontally one below the other. Can anyone plss help me out in exporting the Result in Tabular... (4 Replies)
Hi
I want to display the following input data into the tabular format as shown in the output.
Input.txt:
Following jobs are in pending state for more than 10 minutes:
JOB_ID JOB_SUBMIT_ID
MAHAR 784308
PUNJA 109367
Following jobs are running for longer time:
JOB_ID... (1 Reply)
Hi,
I have a file which contains the data in the below format and need to develop a script which will give the output in the tabular format.
Could you please advice me.
Folder:
Workflow: version .
Workflow run status:
Workflow run error code:
Schedule time:
Workflow run type: ... (2 Replies)