Help needed with an awk command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help needed with an awk command
# 1  
Old 05-25-2018
Thanks a lot RudiC ... the code worked ....

---------- Post updated at 06:47 AM ---------- Previous update was at 06:46 AM ----------

I used
Code:
 awk -vKEYARR="w m l"  ' BEGIN   {for (n=split (KEYARR, TMP); n; n--) KEYS[TMP[n]] } {RES = 1; for (i=1; i<=NF; i++) if ($i in KEYS) RES*=$(i+1); print RES}' tmp_file

---------- Post updated at 06:47 AM ---------- Previous update was at 06:47 AM ----------

had put it in a single line ....

Thanks again
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk - help needed please

Hi.. have a file as below, appreciate if someone can help on this 143|500| 10| 23353 22131 23355 23354 23358 23352 23357 23350 23349 23351| RAID5 213|1008| 9| 22419 22412 221 22413 22414 22416 22417 22415 22418| RAID6 1088|500| 5| 22243 22240 22244 22242 22241| RAID5 322|1200| 12|... (6 Replies)
Discussion started by: richard0@rediff
6 Replies

2. Shell Programming and Scripting

awk help needed

Hi Everyone, i have following in my file 1 2 3 4 5 6 . . 100 and now i want the output as 1 4 7 ..........so on..............97 100 (10 Replies)
Discussion started by: zozoo
10 Replies

3. Shell Programming and Scripting

Help needed with file output awk sed command - please

Hi I have a file that contains lines starting with a particular string plus a Colon: I need to output all these lines but only what comes after the colon Can you pelase assist? Example of lines in the file: com.ubs.f35.cashequities/cashequities: 1 2 ... (5 Replies)
Discussion started by: mnassiri
5 Replies

4. Shell Programming and Scripting

awk help needed

Hi Experts, I have a file (file 1) with several columns and I need to create 2 files based on the data of 20th column of file 1. Criteria 1 : If the 20th field of file1 is empty , copy the entire records to file 2. I am successfully able to do this with the following awk code : awk... (2 Replies)
Discussion started by: nua7
2 Replies

5. UNIX for Dummies Questions & Answers

help needed for awk

Dear all, I am new to use unix. I run the following command and got the error. Anyone knows how should I modify the command. Thanks a lot! $ for chr in 'seq 1 23'; do awk 'BEGIN {print "T","pheno";}{print "M",$2}' out_${chr}.map > dat_${chr}.dat; done error message:... (2 Replies)
Discussion started by: forevertl
2 Replies

6. Shell Programming and Scripting

awk command in script gives error while same awk command at prompt runs fine: Why?

Hello all, Here is what my bash script does: sums number columns, saves the tot in new column, outputs if tot >= threshold val: > cat getnon0file.sh #!/bin/bash this="getnon0file.sh" USAGE=$this" InFile="xyz.38" Min="0.05" # awk '{sum=0; for(n=2; n<=NF; n++){sum+=$n};... (4 Replies)
Discussion started by: catalys
4 Replies

7. UNIX for Dummies Questions & Answers

Awk help needed

I have a log file monitor script that checks through a log file for a string. I use awk to search the log file, starting at the last checked line, for the specified string and then output the count and the last row number checked. The part of the script that does all the work is here: set --... (6 Replies)
Discussion started by: mglenney
6 Replies

8. Shell Programming and Scripting

help needed in awk

Hi , i have a file a.txt like this: far near veryfar toonear typeset var1=veryfar to extract the text between two strings i use the following command : awk '/far/,$veryfar/' a.txt its not working can nyone tell pls whats wrong in it ? i doubt can we use variable in awk like this... (3 Replies)
Discussion started by: santosh1234
3 Replies

9. UNIX for Advanced & Expert Users

help needed on awk

Hi i have a file /services which has the following content. ff1 2201 f1 2202 In my program following logic is used. SVC=$NICKNAME PRT=$(awk '/'$SVC'/ { print substr($2,1,index($2,"/")-1); }'/services) where SVC will be ff1 and f1. when SVC is f1 the output of the... (2 Replies)
Discussion started by: blooddy
2 Replies

10. Shell Programming and Scripting

awk help needed.

Dear All, I want to compare column 3 and column 4 of files(File1 and File2) and want to get the matched records in one file and rejected records in another file.I have tried an awk script,but as Iam not good in it,I cant able to continue.Can anyone help me in this one. File 1... (0 Replies)
Discussion started by: cskumar
0 Replies
Login or Register to Ask a Question
DACS_MEX(8)						     DACS Web Services Manual						       DACS_MEX(8)

NAME
dacs_mex - WS-MetadataExchange responder for Information Cards SYNOPSIS
dacs_mex [dacsoptions[1]] DESCRIPTION
This program is part of the DACS suite. The dacs_mex web service is the WS-MetadataExchange responder for DACS's managed Information Cards. Refer to dacs_infocard(8)[2] and dacs_managed_infocard(8)[3] for additional information. OPTIONS
Web Service Arguments dacs_mex understands the following CGI arguments: AUTHTYPE This argument identifies the authentication credential type required by the IP/STS. The following values are understood: o PASSWD The UsernamePasswordCredential authentication credential type is required. o CERT The X509V3Credential authentication credential type is required. o CARD The SelfIssuedCredential authentication credential type is required. DIAGNOSTICS
The program exits 0 if everything was fine, 1 if an error occurred. BUGS
As this is a relatively new and complicated feature, please test carefully. SEE ALSO
dacsinfocard(1)[4], dacs.conf(5)[5], dacs_authenticate(8)[6], dacs_sts(8)[7], Using InfoCards With DACS[8] AUTHOR
Distributed Systems Software (www.dss.ca[9]) COPYING
Copyright2003-2012 Distributed Systems Software. See the LICENSE[10] file that accompanies the distribution for licensing information. NOTES
1. dacsoptions http://dacs.dss.ca/man/dacs.1.html#dacsoptions 2. dacs_infocard(8) http://dacs.dss.ca/man/dacs_infocard.8.html 3. dacs_managed_infocard(8) http://dacs.dss.ca/man/dacs_managed_infocard.8.html 4. dacsinfocard(1) http://dacs.dss.ca/man/dacsinfocard.1.html 5. dacs.conf(5) http://dacs.dss.ca/man/dacs.conf.5.html 6. dacs_authenticate(8) http://dacs.dss.ca/man/dacs_authenticate.8.html 7. dacs_sts(8) http://dacs.dss.ca/man/dacs_sts.8.html 8. Using InfoCards With DACS http://dacs.dss.ca/man/using-infocards-with-dacs.html 9. www.dss.ca http://www.dss.ca 10. LICENSE http://dacs.dss.ca/man/../misc/LICENSE DACS 1.4.27b 10/22/2012 DACS_MEX(8)