select lines with certain values on certain fields with awk
I need a awk command to select from a log-file only the lines that have on the 2nd field (considering "|" separator) one of the values 10.216.22.XX or 10.216.22.YY or 10.216.22.ZZ and on the 4th field only values that contain strictly digits. I want the command to work parsing the file only once (I don;t want pipes in the command)
I know that to select the lines with only digits in the value from 4th field I use this command :
So I basically want to add an additional condition to this command referring to the 2nd field where I'm looking for one of the values "10.216.22.XX|10.216.22.YY|10.216.22.ZZ" . Basically this is how a line I target should look like :
20120923000000123 | 10.216.22.XX | portalPaymentFixed | 1256004 | Y |
Hi,
I want to print certain fields from my data file depending on certain conditions. Somebody pls let me know how to send it to awk.
The command below is the one which I want to use in a shell script and this prints fine
cat ./datafile.dat | grep -i $SEARCH_STR | awk -F: '{ print $1 $2 $3... (5 Replies)
If i have a log file record.txt, with 10 fields
- First field is datetime
- 7th field is status
- 8th filed is name
- The last field (10th) is epoch time of the first field
02/17/2012 1:47 PM||||||In Use|chicken||1329515230
02/17/2012 2:53 PM||||||Available|chicken||1329519195
02/17/2012... (4 Replies)
Hi all !
If there is only one single value in a column (e.g. column 1 below), then return this value in the same output column.
If there are several values in the same column (e.g. column 2 below), then return the different values separated by "," in the output.
pipe-separated input:
... (11 Replies)
Hi all,
I am new to AWK and I am trying to solve a problem that is probably easy for an expert. Suppose I have the following data file input.txt:
20 35 43
20 23 54
20 62 21
20.5 43 12
20.5 33 11
20.5 89 87
21 33 20
21 22 21
21 56 87
I want to select from all lines having the... (4 Replies)
In the attached file I am trying to use awk to extract multiple values and create the tab-delimited desired output.
In the output R_Index is a the sequential # and Pre_Enrichment is defaulted to ..
I can extract from the values to the side of the keywords, but most are above and I can not... (2 Replies)
I am trying to use awk to find all the $3 values in file2 that are between $2 and $3 in file1. If a value in $3 of file2 is between the file1 fields then it is printed along with the $6 value in file1. Both file1 and file2 are tab-delimited as well as the desired output. If there is nothing to... (4 Replies)
Hello,
I want to get the maximum value of each record separated by empty line based on the 3rd column of each row within each record?
Input:
A1 chr5D 634 7 82 707
A2 chr5D 637 6 82 713
A3 chr5D 637 5 82 713
A4 chr5D 626 1 82 704... (4 Replies)
In the awk below, what I am attempting to do is check each line in the tab-delimeted input, which has ~20 lines in it, for a keyword
SVTYPE=Fusion. If the keyword is found I am splitting $3 using the . (dot) and reading the portion before and after the dot in an array a.
If it does have that... (12 Replies)
In the awk below I am trying to output those lines that Match between file1 and file2, those Missing in file1, and those missing in file2. Using each $1,$2,$4,$5 value as a key to match on, that is if those 4 fields are found in both files the match, but if those 4 fields are not found then missing... (0 Replies)
In the awk below I am trying to use the file1 as a match to file2. In file2 the contents of $5,&6,and $7 (always tab-delimited) and are copied to the output under the header Quality metrics. The below executes but the output is empty. I have added comments to help and show my thinking. Thank you... (0 Replies)
Discussion started by: cmccabe
0 Replies
LEARN ABOUT OPENSOLARIS
iconv_dhn
iconv_dhn(5) Standards, Environments, and Macros iconv_dhn(5)NAME
iconv_dhn - code set conversion tables for DHN (Dom Handlowy Nauki)
DESCRIPTION
The following code set conversions are supported:
+--------------------------------------------------------------------+
| Code Set Conversions Supported |
+--------------+--------+--------------+--------+--------------------+
| Code |Symbol |Target Code |Symbol | Target Output |
+--------------+--------+--------------+--------+--------------------+
|DHN |dhn |ISO 8859-2 |iso2 | ISO Latin 2 |
+--------------+--------+--------------+--------+--------------------+
|DHN |dhn |MS 1250 |win2 | Windows Latin 2 |
+--------------+--------+--------------+--------+--------------------+
|DHN |dhn |MS 852 |dos2 | MS-DOS Latin 2 |
+--------------+--------+--------------+--------+--------------------+
|DHN |dhn |Mazovia |maz | Mazovia |
+--------------+--------+--------------+--------+--------------------+
CONVERSIONS
The conversions are performed according to the following tables. All values in the tables are given in octal.
DHN to ISO 8859-2
For the conversion of DHN to ISO 8859-2, all characters not in the following table are mapped unchanged.
+-----------------------------------------------------------------+
| | Conversions|Performed | |
| DHN | ISO 8859-2 | DHN | ISO 8859-2 |
|24-177 | 40 |222 |40 |
|200 | 241 |223 |364 |
|201 | 306 |224 |366 |
|202 | 312 |225-230 |40 |
|203 | 243 |231 |326 |
|204 | 321 |232 |334 |
|205 | 323 |233-237 |40 |
|206 | 246 |240 |341 |
|207 | 254 |241 |355 |
|210 | 257 |242 |363 |
|211 | 261 |243 |372 |
|212 | 346 |244-340 |40 |
|213 | 352 |341 |337 |
|214 | 263 |342-365 |40 |
|215 | 361 |366 |367 |
|216 | 363 |367 |40 |
|217 | 266 |370 |260 |
|220 | 274 |371-376 |40 |
|221 | 277 | | |
+---------------+----------------+----------------+---------------+
DHN to MS 1250
For the conversion of DHN to MS 1250, all characters not in the following table are mapped unchanged.
+-----------------------------------------------------------------+
| | Conversions|Performed | |
| DHN | MS 1250 | DHN | MS 1250 |
|200 | 245 |233-237 |40 |
|201 | 306 |240 |341 |
|202 | 312 |241 |355 |
|203 | 243 |242 |363 |
|204 | 321 |243 |372 |
|205 | 323 |244-251 |40 |
|206 | 214 |252 |254 |
|207 | 217 |253-255 |40 |
|210 | 257 |256 |253 |
|211 | 271 |257 |273 |
|212 | 346 |260-340 |40 |
|213 | 352 |341 |337 |
|214 | 263 |342-345 |40 |
|215 | 361 |346 |265 |
|216 | 363 |347-360 |40 |
|217 | 234 |361 |261 |
|220 | 237 |362-365 |40 |
|221 | 277 |366 |367 |
|222 | 40 |367 |40 |
|223 | 364 |370 |260 |
|224 | 366 |371 |40 |
|225-230 | 40 |372 |267 |
|231 | 326 |373-376 |40 |
|232 | 334 | | |
+---------------+----------------+----------------+---------------+
DHN to MS 852
For the conversion of DHN to MS 852, all characters not in the following table are mapped unchanged.
+-----------------------------------------------------------------+
| | Conversions|Performed | |
| DHN | MS 852 | DHN | MS 852 |
|200 | 244 |212 |206 |
|201 | 217 |213 |251 |
|202 | 250 |214 |210 |
|203 | 235 |215 |344 |
|204 | 343 |216 |242 |
|205 | 340 |217 |230 |
|206 | 227 |220 |253 |
|207 | 215 |221 |276 |
|210 | 275 |222-375 |40 |
|211 | 245 | | |
+---------------+----------------+----------------+---------------+
DHN to Mazovia
For the conversion of DHN to Mazovia, all characters not in the following table are mapped unchanged.
+-----------------------------------------------------------------+
| | Conversions|Performed | |
| DHN | Mazovia | DHN | Mazovia |
|200 | 217 |212 |215 |
|201 | 225 |213 |221 |
|202 | 220 |214 |222 |
|203 | 234 |215 |244 |
|204 | 245 |216 |242 |
|205 | 243 |217 |236 |
|206 | 230 |220 |246 |
|207 | 240 |221 |247 |
|210 | 241 |222-247 |40 |
|211 | 206 | | |
+---------------+----------------+----------------+---------------+
FILES
/usr/lib/iconv/*.so conversion modules
/usr/lib/iconv/*.t conversion tables
/usr/lib/iconv/iconv_data list of conversions supported by conversion tables
SEE ALSO iconv(1), iconv(3C), iconv(5)SunOS 5.10 18 Apr 1997 iconv_dhn(5)