Sponsored Content
Full Discussion: Filtering text with awk
Top Forums UNIX for Beginners Questions & Answers Filtering text with awk Post 303030139 by RudiC on Wednesday 6th of February 2019 12:03:15 PM
Old 02-06-2019
It is common use in these fora to show what you've tried and where you were stuck when posting a problem. Try



Code:
awk '
/>Cluster/      {if (CNT) print CNT
                 CNT = 0
                 next
                }
                {CNT++
                }
/\*/            {printf "%snr=", $NF
                }
END             {print CNT
                }
' FS=, file
 >last294258;size=1;... *nr=1
 >last111510;size=1;... *nr=4
 >last355423;size=1;... *nr=1

This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Filtering text from a string

I'm trying to write a script which prints out the users who are loged in. Printing the output of the "users" command isn't the problem. What I want is to filter out my own username. users | grep -v (username) does not work because the whole line in which username exists is suppressed. If... (5 Replies)
Discussion started by: Cozmic
5 Replies

2. UNIX for Advanced & Expert Users

awk filtering ?

I have a Ques. Regarding awk I have few strings in a file, like.. ABC DEF_ABC GHI_ABC GHI Now I want string which has only 'ABC', not the part of any other string as it is also present in 'DEF_ABC' Output should be ABC Please guide me asap !! Thanks :b: (4 Replies)
Discussion started by: varungupta
4 Replies

3. Shell Programming and Scripting

Another text filtering question

I want to remove everything from a file but the word following the search word. Example: crap crap crap crap SearchWord WordToKeep crap crap crap How would I do this with say awk or grep? Thank you! (4 Replies)
Discussion started by: DethLark
4 Replies

4. Shell Programming and Scripting

filtering text

Hi how can I filter the text using this one. SAMPLE servervmpool -listall|tail -11 ================================================================================ pool number: 112 pool name: Net-Ora-1wk description: Net-Ora-1wk max partially full: 0... (12 Replies)
Discussion started by: kenshinhimura
12 Replies

5. Shell Programming and Scripting

text processing and filtering scripting

Still new to bash. Using debian lenny 5, bash version 3.2.39. I'm working on three scripts. I need help completing them. One script that inputs a plain text file, echo then chop it up into separate whitespace-delimited strings as an output. Not sure how to do this... for example, the... (4 Replies)
Discussion started by: l20N1N
4 Replies

6. Shell Programming and Scripting

Filtering out text with awk

(0 Replies)
Discussion started by: nilekyle
0 Replies

7. Shell Programming and Scripting

filtering with awk

i have question about awk ex: input.txt 1252468812,yahoo,3.5 1252468812,hotmail,2.4 1252468819,yahoo,1.2 msn,1252468812,8.9 1252468923,gmail,12 live,1252468812,3.4 yahoo,1252468812,9.0 1252468929,msn,1.2 output.txt 1252468812,yahoo,3.5 1252468812,hotmail,2.4 msn,1252468812,8.9... (3 Replies)
Discussion started by: zvtral
3 Replies

8. Shell Programming and Scripting

Parsing and filtering multiline text into comma separated line

I have a log file that contains several reports with following format. <Start of delimiter> Report1 header Report1 header continue Report1 header continue Record1 header Record1 header continue Record1 header continue field1 field2 field3 field4 ------... (1 Reply)
Discussion started by: yoda9691
1 Replies

9. Shell Programming and Scripting

text filtering

INPUT FILE: Date: 10-JUN-12 12:00:00 B 0: 00 00 00 00 10 00 16 28 B 120: 00 00 00 39 53 32 86 29 Date: 10-JUN-12 12:00:10 B 0: 00 00 00 00 10 01 11 22 B 120: 00 00 00 29 23 32 16 29 Date: 10-JUN-12 12:00:20 B 0: 00 00 00 00 10 02 17 29 B 120: 00 00 35 51 42 66 14 Date: 10-JUN-12... (5 Replies)
Discussion started by: thibodc
5 Replies

10. Shell Programming and Scripting

Filtering data from text to csv

Hello, Is there a way to filerter data from a text file as shown below to a Column e.g. hostname nfsmount as two separate column. Currently I could get hostname and the mount is appearing below.. using this script #! /bin/bash for i in `cat fqdn.txt` do echo "$i ............ " >>... (3 Replies)
Discussion started by: Cy Pqa
3 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 01:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy