Sponsored Content
Full Discussion: awk sub-field?
Top Forums UNIX for Dummies Questions & Answers awk sub-field? Post 8119 by rwb1959 on Friday 5th of October 2001 04:07:51 PM
Old 10-05-2001
I keep forgetting... the angle brackets get eaten Smilie

The split() function has the syntax:
split(string, array, [field separator])

Note the field separator is optional (in [] brackets).
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

awk - Summing a field based on another field

So, I need to do some summing. I have an Apache log file with the following as a typical line: 127.0.0.1 - frank "GET /apache_pb.gif HTTP/1.0" 200 2326 Now, what I'd like to do is a per-minute sum. So, I can have awk tell me the individual minutes, preserving the dates(since this is a... (7 Replies)
Discussion started by: treesloth
7 Replies

2. Shell Programming and Scripting

awk, comma as field separator and text inside double quotes as a field.

Hi, all I need to get fields in a line that are separated by commas, some of the fields are enclosed with double quotes, and they are supposed to be treated as a single field even if there are commas inside the quotes. sample input: for this line, 5 fields are supposed to be extracted, they... (8 Replies)
Discussion started by: kevintse
8 Replies

3. Shell Programming and Scripting

Awk Search text string in field, not all in field.

Hello, I am using awk to match text in a tab separated field and am able to do so when matching the exact word. My problem is that I would like to match any sequence of text in the tab-separated field without having to match it all. Any help will be appreciated. Please see the code below. awk... (3 Replies)
Discussion started by: rocket_dog
3 Replies

4. Shell Programming and Scripting

AWK: Pattern match between 2 files, then compare a field in file1 as > or < field in file2

First, thanks for the help in previous posts... couldn't have gotten where I am now without it! So here is what I have, I use AWK to match $1 and $2 as 1 string in file1 to $1 and $2 as 1 string in file2. Now I'm wondering if I can extend this AWK command to incorporate the following: If $1... (4 Replies)
Discussion started by: right_coaster
4 Replies

5. Shell Programming and Scripting

awk repeat one field at all lines and modify field repetitions

Hello experts I have a file with paragraphs begining with a keeping date and ending with "END": 20120301 num num John num num A keepnum1 num num kathrin num num A keepnum1 num num kathrin num num B keepnum2 num num Pete num num A keepnum1 num num Jacob num... (2 Replies)
Discussion started by: phaethon
2 Replies

6. 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

7. Shell Programming and Scripting

How can awk ignore the field delimiter like comma inside a field?

We have a csv file as mentioned below and the requirement is to change the date format in file as mentioned below. Current file (file.csv) ---------------------- empname,date_of_join,dept,date_of_resignation ram,08/09/2015,sales,21/06/2016 "akash,sahu",08/10/2015,IT,21/07/2016 ... (6 Replies)
Discussion started by: gopal.biswal
6 Replies

8. Shell Programming and Scripting

awk to adjust coordinates in field based on sequential numbers in another field

I am trying to output a tab-delimited result that uses the data from a tab-delimited file to combine and subtract specific lines. If $4 matches in each line then the first matching sequential $6 value is added to $2, unless the value is 1, then the original $2 is used (like in the case of line... (3 Replies)
Discussion started by: cmccabe
3 Replies

9. Shell Programming and Scripting

awk to update field using matching value in file1 and substring in field in file2

In the awk below I am trying to set/update the value of $14 in file2 in bold, using the matching NM_ in $12 or $9 in file2 with the NM_ in $2 of file1. The lengths of $9 and $12 can be variable but what is consistent is the start pattern will always be NM_ and the end pattern is always ;... (2 Replies)
Discussion started by: cmccabe
2 Replies

10. UNIX for Beginners Questions & Answers

Problem with getting awk to multiply a field by a value set based on condition of another field

Hi, So awk is driving me crazy on this one. I have searched everywhere and read man, docs and every related post Google can find and still no luck. The actual files I need to run this on are sensitive in nature, but it is the same thing as if I needed to calculate weighted grades for multiple... (15 Replies)
Discussion started by: cotilloe
15 Replies
Qpsmtpd::Address(3pm)					User Contributed Perl Documentation				     Qpsmtpd::Address(3pm)

NAME
Qpsmtpd::Address - Lightweight E-Mail address objects DESCRIPTION
Based originally on cut and paste from Mail::Address and including every jot and tittle from RFC-2821/2822 on what is a legal e-mail address for use during the SMTP transaction. USAGE
my $rcpt = Qpsmtpd::Address->new('<email.address@example.com>'); The objects created can be used as is, since they automatically stringify to a standard form, and they have an overloaded comparison for easy testing of values. METHODS
new() Can be called two ways: o Qpsmtpd::Address->new('<full_address@example.com>') The normal mode of operation is to pass the entire contents of the RCPT TO: command from the SMTP transaction. The value will be fully parsed via the canonify method, using the full RFC 2821 rules. o Qpsmtpd::Address->new("user", "host") If the caller has already split the address from the domain/host, this mode will not canonify the input values. This is not recommended in cases of user-generated input for that reason. This can be used to generate Qpsmtpd::Address objects for accounts like "<postmaster>" or indeed for the bounce address "<>". The resulting objects can be stored in arrays or used in plugins to test for equality (like in badmailfrom). canonify() Primarily an internal method, it is used only on the path portion of an e-mail message, as defined in RFC-2821 (this is the part inside the angle brackets and does not include the "human readable" portion of an address). It returns a list of (local-part, domain). parse() Retained as a compatibility method, it is completely equivalent to new() called with a single parameter. address() Can be used to reset the value of an existing Q::A object, in which case it takes a parameter with or without the angle brackets. Returns the stringified representation of the address. NOTE: does not escape any of the characters that need escaping, nor does it include the surrounding angle brackets. For that purpose, see format. format() Returns the canonical stringified representation of the address. It does escape any characters requiring it (per RFC-2821/2822) and it does include the surrounding angle brackets. It is also the default stringification operator, so the following are equivalent: print $rcpt->format(); print $rcpt; user([$user]) Returns the "localpart" of the address, per RFC-2821, or the portion before the '@' sign. If called with one parameter, the localpart is set and the new value is returned. host([$host]) Returns the "domain" part of the address, per RFC-2821, or the portion after the '@' sign. If called with one parameter, the domain is set and the new value is returned. notes($key[,$value]) Get or set a note on the address. This is a piece of data that you wish to attach to the address and read somewhere else. For example you can use this to pass data between plugins. COPYRIGHT
Copyright 2004-2005 Peter J. Holzer. See the LICENSE file for more information. perl v5.14.2 2009-04-02 Qpsmtpd::Address(3pm)
All times are GMT -4. The time now is 10:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy