Sponsored Content
Top Forums Shell Programming and Scripting how to parse with awk (using different fields), then group by a field? Post 302501159 by yinyuemi on Wednesday 2nd of March 2011 08:37:12 PM
Old 03-02-2011
Code:
echo "tom | 223-2222-4444 , randofield" |awk '{print "social security : " $3 " | name : "$1" | third filed : "$NF}'
social security : 223-2222-4444 | name : tom | third filed : randofield

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk-Group count of field

Hi, Suppose if i am having a file with following records as given below. 5555 6756 5555 4555 4555 6767 how can i get the count of each record using AWK. Eg:5555 count should be 2 4555 count should be 2 6767 count should be 1 ... (5 Replies)
Discussion started by: tinivt
5 Replies

2. Shell Programming and Scripting

Using AWK to parse a delimited field

Hi everyone! How can I parse a delimited field using AWK? For example, if I have lastName#firstName or lastName*firstName. I'd like an AWK script that would return lastName and then another that would return firstName? Is this possible? (13 Replies)
Discussion started by: Fatbob
13 Replies

3. Shell Programming and Scripting

awk - print all fields except for last field

How do I print all the fields of a record except for the $(NF) field? (4 Replies)
Discussion started by: locoroco
4 Replies

4. UNIX for Dummies Questions & Answers

keeping last record among group of records with common fields (awk)

input: ref.1;rack.1;1 #group1 ref.1;rack.1;2 #group1 ref.1;rack.2;1 #group2 ref.2;rack.3;1 #group3 ref.2;rack.3;2 #group3 ref.2;rack.3;3 #group3 Among records from same group (i.e. with same 1st and 2nd field - separated by ";"), I would need to keep the last record... (5 Replies)
Discussion started by: beca123456
5 Replies

5. Shell Programming and Scripting

How to print 1st field and last 2 fields together and the rest of the fields after it using awk?

Hi experts, I need to print the first field first then last two fields should come next and then i need to print rest of the fields. Input : a1,abc,jsd,fhf,fkk,b1,b2 a2,acb,dfg,ghj,b3,c4 a3,djf,wdjg,fkg,dff,ggk,d4,d5 Expected output: a1,b1,b2,abc,jsd,fhf,fkk... (6 Replies)
Discussion started by: 100bees
6 Replies

6. Shell Programming and Scripting

Insert field between two fields using awk or sed

Hi All, I am trying to insert two columns in the following text. I tried awk but failed to achieve. Highly appreciate your help DATETIME="28-Sep-2013;20:09:08;" CONTROL="AB" echo "Myfile.txt;11671;7824.90;2822.48" The DATETIME will be inserted at the beginning and CONTROL will... (4 Replies)
Discussion started by: angshuman
4 Replies

7. Shell Programming and Scripting

awk Parse And Create Multiple Files Based on Field Value

Hello: I am working parsing a large input file which will be broken down into multiples based on the second field in the file, in this case: STORE. The idea is to create each file with the corresponding store number, for example: Report_$STORENUM_$DATETIMESTAMP , and obtaining the... (7 Replies)
Discussion started by: ec012
7 Replies

8. Shell Programming and Scripting

awk script to parse case with information in two fields of file

The below awk parser works for most data inputs, but I am having trouble with the last one. The problem is in the below rules steps 1 and 2 come from $2 (NC_000013.10:g.20763686_20763687delinsA) and steps 3 and 4 come from $1 (NM_004004.5:c.34_35delGGinsT). Parse Rules: The header is... (0 Replies)
Discussion started by: cmccabe
0 Replies

9. Shell Programming and Scripting

awk to parse field and include the text of 1 pipe in field 4

I am trying to parse the input in awk to include the |gc= in $4 but am not able to. The below is close: awk so far: awk '{sub(/\|]+]++/, ""); print }' input.txt Input chr1 955543 955763 AGRN-6|pr=2|gc=75 0 + chr1 957571 957852 AGRN-7|pr=3|gc=61.2 0 + chr1 970621 ... (7 Replies)
Discussion started by: cmccabe
7 Replies

10. UNIX for Beginners Questions & Answers

Awk: group multiple fields from different records

Hi, My input looks like that: A|123|qwer A|456|tyui A|456|wsxe B|789|dfgh Using awk, I am trying to get: A|123;456|qwer;tyui;wsxe B|789|dfgh For records with same $1, group all the $2 in a field (without replicates), and all the $3 in a field (without replicates). What I have tried:... (6 Replies)
Discussion started by: beca123456
6 Replies
sasl_getprop(10 July 2001)												sasl_getprop(10 July 2001)

NAME
sasl_getprop - Get a SASL property SYNOPSIS
#include <sasl/sasl.h> int sasl_getprop(sasl_conn_t *conn, int propnum, const void ** pvalue); DESCRIPTION
sasl_getprop gets the value of a SASL property. For example after successful authentication a server may wish to know the authorization name. Or a client application may wish to know the strength of the negotiated security layer. conn is the SASL connection object. propnum is the identifier for the property requested and pvalue is filled in on success. List of prop- erties follows: SASL_USERNAME - pointer to NUL terminated user name SASL_SSF - security layer security strength factor, if 0, call to sasl_encode, sasl_decode unnecessary SASL_MAXOUTBUF - security layer max output buf unsigned SASL_DEFUSERREALM - server authentication realm used SASL_GETOPTCTX - context for getopt callback SASL_IPLOCALPORT - local address string SASL_IPREMOTEPORT - remote address string SASL_SERVICE - service passed to sasl_*_new SASL_SERVERFQDN - serverFQDN passed to sasl_*_new SASL_AUTHSOURCE - name of auth source last used, useful for failed authentication tracking SASL_MECHNAME - active mechanism name, if any SASL_PLUGERR - similar to sasl_errdetail RETURN VALUE
Returns SASL_OK on success. SASL error code on failure. CONFORMING TO
RFC 2222 SEE ALSO
sasl(3), sasl_errors(3), sasl_server_new(3), sasl_client_new(3) SASL man pages SASL sasl_getprop(10 July 2001)
All times are GMT -4. The time now is 03:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy