Sponsored Content
Full Discussion: awk Script to format output
Top Forums Shell Programming and Scripting awk Script to format output Post 302916833 by RudiC on Friday 12th of September 2014 06:13:50 AM
Old 09-12-2014
That looks like "Suspended" is the only error state in your file. Try
Code:
awk     '/^ *Server:/   {if (NR>1) print RCNT==CNT?"OK: "RCNT:"Suspended: "SCNT
                         printf "%s: ", $NF
                         RCNT=SCNT=CNT=0}
         $NF ~ /^Run/   {RCNT++; CNT++}
         $NF ~ /^Sus/   {SCNT++; CNT++}
         END            {print RCNT==CNT?"OK: "RCNT:"Error: "SCNT}
        ' file
Test1: OK: 2
Server1: Suspended: 1
Server2: OK: 2

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Output in a particular format using AWK

Hi All, I am trying to check if if column 5 is greater than 90. If greater it will print the term in column 6, else if all are within limit, then it will output "Size is within limit". I can't seem to do that with the below code. The output should only be 1 statement of "Size is within the... (4 Replies)
Discussion started by: Raynon
4 Replies

2. Shell Programming and Scripting

[need help] output format from awk

hi all, i have a problem with my nawk command output below is the description : nawk $12 == "00008001" { cnt++;cs_cd } END {for(cd in cs_cd) print cd, cs_cd } 2007020814.TDR output : 133 123 desire output: 133,123,.... please advices thank you so much (6 Replies)
Discussion started by: bucci
6 Replies

3. Shell Programming and Scripting

Format output using awk in script.

Guys, I have a script which hits the database and pulls the information that I need into files. Now I want to format these files to make them easy to read. The sample format of the file will be like.... <Start_of_File> Header1 .....xsdfsfa...adfa...... Header2 ....afefas .aefaefsdf...... (8 Replies)
Discussion started by: bperl
8 Replies

4. Shell Programming and Scripting

scripting/awk help : awk sum output is not comming in regular format. Pls advise.

Hi Experts, I am adding a column of numbers with awk , however not getting correct output: # awk '{sum+=$1} END {print sum}' datafile 2.15291e+06 How can I getthe output like : 2152910 Thank you.. # awk '{sum+=$1} END {print sum}' datafile 2.15079e+06 (3 Replies)
Discussion started by: rveri
3 Replies

5. Shell Programming and Scripting

awk - format output

Input file1 zone: BAU_SERVER1 C0:50:76:01:C6:20:00:12; 50:06:01:69:3B:20:14:8B; 50:06:01:60:3B:20:14:8B zone: BAU_SERVER2 C0:50:76:01:C6:20:00:08; 50:06:01:69:3B:20:14:8B; 50:06:01:60:3B:20:14:8B zone: ... (4 Replies)
Discussion started by: greycells
4 Replies

6. Shell Programming and Scripting

awk to format an output

awk experts, I have in put file with time stamp followed by "," separated data. same patern continues. The output need time stamp in first columns and data total in 2nd columns. Input file T 9:15 d0,1,3,3 d1,2,1,1 d2,3,1,5 e1,1,1,1 T 9:30 d0,1,1,1 d1,2,3,2 d3,1,2,1... (10 Replies)
Discussion started by: arv_cds
10 Replies

7. UNIX for Dummies Questions & Answers

after awk-> format output

hi i have a awk command with several querys.... awk 'FS="|""; print $4, $5, $6...etc.... $4 gives me the date 20120304 $5 is timestamp 101023 I want to format these in 2012.03.04 or 2012/03/04 10:10:23 but have no idea, if this is possible with format-parameters in the awk... (2 Replies)
Discussion started by: Jazzmatazz
2 Replies

8. Shell Programming and Scripting

Format output using awk

Hello all , need help with this ... Input File DEV % POOL 0CB4 FBA 2211300 81792 4 IE RAID-5(3+1) R5_EFD100_1 - - 1805376 82 IF RAID-1 M2_FC300_1 - ... (4 Replies)
Discussion started by: greycells
4 Replies

9. Shell Programming and Scripting

Adjusting my awk output format

I've been diving into awk but still learning how to use it for text formatting. Below you can see my results are separated by a comma. Can somebody show me how to separate by TAB as well? An explanation would be appreciated as I did not comprehend the answer in the man pages and would like to gain... (1 Reply)
Discussion started by: sudo
1 Replies

10. Shell Programming and Scripting

Script to generate Excel file or to SQL output data to Excel format/tabular format

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)
Discussion started by: dani1234
6 Replies
PRECV(3PVM)							  PVM Version 3.4						       PRECV(3PVM)

NAME
pvm_precv - Receive a message directly into a buffer. SYNOPSIS
C int info = pvm_precv( int tid, int msgtag, char *buf, int len, int datatype, int *atid, int *atag, int *alen ) Fortran call pvmfprecv( tid, msgtag, buf, len, datatype, atid, atag, alen, info ) PARAMETERS
tid Integer task identifier of sending process (to match). msgtag Integer message tag (to match). msgtag should be >= 0. buf Pointer to a buffer to receive into. len Length of buffer (in multiple of data type size). datatype Type of data to which buf points (see below). atid Returns actual TID of sender. atag Returns actual message tag. alen Returns actual message length. info Returns PvmOk on success. Values less than zero indicate an error. DESCRIPTION
The routine pvm_precv blocks the process until a message with label msgtag has arrived from tid. pvm_precv then places the contents of the message in the supplied buffer, buf, up to a maximum length of len * (size of data type). pvm_precv can receive messages sent by pvm_psend, pvm_send, pvm_mcast, or pvm_bcast. A -1 in msgtag or tid matches anything. This allows the user the following options. If tid = -1 and msgtag is defined by the user, then pvm_precv will accept a message from any process which has a matching msgtag. If msgtag = -1 and tid is defined by the user, then pvm_precv will accept any message that is sent from process tid. If tid = -1 and msgtag = -1, then pvm_precv will accept any message from any process. In C the datatype parameter must be one of the following, depending on the type of data to be unpacked: [Version 3.3.0 - This parameter only determines message length, not data conversion. It only unpacks raw bytes] datatype Data Type PVM_STR string PVM_BYTE byte PVM_SHORT short PVM_INT int PVM_FLOAT real PVM_CPLX complex PVM_DOUBLE double PVM_DCPLX double complex PVM_LONG long integer PVM_USHORT unsigned short int PVM_UINT unsigned int PVM_ULONG unsigned long int In Fortran the same data types specified for unpack should be used. The PVM model guarantees the following about message order. If task 1 sends message A to task 2, then task 1 sends message B to task 2, message A will arrive at task 2 before message B. Moreover, if both messages arrive before task 2 does a receive, then a wildcard receive will always return message A. If pvm_precv is successful, info will be = 0. If some error occurs then info will be < 0. pvm_precv is blocking which means the routine waits until a message matching the user specified tid and msgtag arrives at the local pvmd. If the message has already arrived then pvm_precv returns immediately with the message. pvm_precv does not affect the state of the current receive message buffer (created by the other receive functions). WARNINGS
In some versions of PVM (CM5, I860 and PGON), messages sent using pvm_psend must be received only by pvm_precv, likewise those sent with pvm_send must be received by pvm_recv, pvm_nrecv or pvm_trecv. pvm_psend is not compatible with pvm_recv (nor pvm_send with pvm_precv). In addition, pvm_probe is not interoperable with pvm_psend. This problem occurs because nonstandard message headers are used for efficiency in the pvm_psend function. In the generic Unix version of PVM, the calls are fully interoperable. The message tag space is shared between pvm_send and pvm_psend, so you must be careful to avoid selecting the wrong message (for example by using a wildcard to match the message). EXAMPLES
C: info = pvm_precv( tid, msgtag, array, cnt, PVM_FLOAT, &src, &rtag, &rlen ); Fortran: CALL PVMFPRECV( -1, 4, BUF, CNT, REAL4, > SRC, RTAG, RCNT, INFO ) ERRORS
These error conditions can be returned by pvm_precv PvmBadParam giving an invalid tid, msgtag, or datatype. PvmSysErr pvmd not responding. SEE ALSO
pvm_psend(3PVM), pvm_recv(3PVM) 15 March, 1994 PRECV(3PVM)
All times are GMT -4. The time now is 07:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy