Sponsored Content
Top Forums Shell Programming and Scripting Moving Part of a field to another field using AWK Post 302083108 by vish_indian on Friday 4th of August 2006 05:38:31 AM
Old 08-04-2006
Quote:
what if the Field seperator is a " as opposed to a , ?????
echo "a\"b\"c" | awk -F'"' '{print $1,$2,$3}' " enclosed in ' '

or
echo "a\"b\"c" | awk -F"\"" '{print $1,$2,$3}' " enclosed in " ", preceeded by a \
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extract Part of string from 3rd field $3 using AWK

I'm executing "wc -lc" command in a c shell script to get record count and byte counts and writing them to a file. I get the result with the full pathname of the file. But I do not want the path name to be printed in the output file. I heard that using Awk we can get this but I don't have any... (4 Replies)
Discussion started by: stakuri
4 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: 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

4. Shell Programming and Scripting

awk and get a part of field ?

I have a list of log.txt, thisis a flatfile separate by a pipe | 2012/06/23 18:58:15 | 4:sabercats pid=020272 opened Boards 0, 1, 2, 3 for /home/directory_germany/germany/location/qt/NET12/full_111_ddr5_soq523_2X_FV_4BD_PD3_0.qt/dbFiles/germany.proto |berlin|test1|test2 2012/06/25 17:40:56... (2 Replies)
Discussion started by: sabercats
2 Replies

5. Shell Programming and Scripting

Find and delete part of field with awk or sed

I've got a file that looks like this (the whitespace between commas is intentional): 123456789,12,JOHN H DOE ,DOE/JOHN H ,,,DOE/JOHN H ,,,,,123 FAKE STREET ,SPRINGFIELD,XX, I want to strip just the first name out of the third field so it reads "JOHN,". So far I... (6 Replies)
Discussion started by: Scottie1954
6 Replies

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

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

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
rlm_passwd(5)							 FreeRADIUS Module						     rlm_passwd(5)

NAME
rlm_passwd - FreeRADIUS Module DESCRIPTION
The rlm_passwd module provides authorization via files similar in format to /etc/passwd. The lm_passwd module allows you to retrieve any account information from any files with passwd-like format (/etc/passwd, /etc/group, smb- passwd, .htpasswd, etc). Every field of the file may be mapped to a RADIUS attribute, with one of the fields used as a key. The module reads the file when it initializes, and caches the data in memory. As a result, it does not support dynamic updates of the files (the server has to be HUP'd), but it is very fast, even for files with thousands of lines. The configuration item(s): filename The path to the file. delimiter = ":" The character to use as a delimiter between fields. The default is ":" hash_size The size of the hashtable. If 0, then the passwords are not cached and the passwd file is parsed for every request. We do not rec- ommend such a configuration. A larger hash_size means less probability of collision and faster search in hashtable. Having a hash_size in the range of 30-100% of the number of passwd file records is reasonable. allow_multiple_keys If set to 'yes', and more than one record in file matches the request, then the attributes from all records will be used. If set to 'no' (the default) the module will warn about duplicated records. ignore_nislike If set to 'yes', then all records from the file beginning with the '+' sign will be ignored. The default is 'no'. format The format of the fields in the file, given as an example line from the file, with the content of the fields as the RADIUS attributes which the fields map to. The fields are seperated by the ':' character. The key field is signified by being preceded with a '*' character, which indicates that the field has only one key, like the /etc/passwd file. The key field may instead be preceded with '*,', which indicates that the field has multiple possible keys, like the /etc/group file. The other fields signify RADIUS attributes which, by default, are added to the configuration items for a request. To add an attribute to the request (as though it was sent by the NAS), prefix the attribute name in the "format" string with the '~' char- acter. To add an attribute to the reply (to be sent back to the NAS) prefix the attribute name in the "format" string with the '=' character. ignore_empty This configuration item defaults to "yes". If there is no value for the attribute, then the attribute is not added. By setting this value to "no", you can force the attribute to be added, even if there is no value. EXAMPLES
format = "My-Group:::*,User-Name" Parse a file similar to the /etc/group file. An entry matches a request when the name in a User-Name attribute exists in the comma- seperated list of a line in the file. When an entry matches, a "My-Group" attribute will be created and added to the configuration items for the request. The value of that attribute will be taken from the first field of the matching line in the file. The ":::" in the format string means that there are extra two fields in the line, in between the group name and list of user names. Those fields do not map to any RADIUS attribute, and are therefore ignored. For this example to work in practice, you will have to add the My-Group attribute to the dictionary file. See the dictionary manual page for details on how this may be done. format = "~My-Group:::*,User-Name" Similar to the previous entry, except the My-Group attribute is added to the request, as though it was sent by the NAS. SECTIONS
authorize FILES
/etc/raddb/radiusd.conf SEE ALSO
radiusd(8), radiusd.conf(5) dictionary(5), AUTHOR
Alan DeKok <aland@freeradius.org> 14 April 2004 rlm_passwd(5)
All times are GMT -4. The time now is 08:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy