|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Print lines that match regex on xth string
Hello, I need an awk command to print only the lines that match regex on xth field from file. For example if I use this command Code:
awk -F"|" ' $22 == "20130117090000.*" ' It wont work, I think, because single quotes wont allow the usage of the metacharacter star * . On the other hand I dont know what other syntax should I use to avoid the usage of the single quotes. |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Code:
awk -F"|" '$22 ~ /20130117090000/' ... |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Hello, thank you, yes this was what I was looking for. Didn't think to use "~"
![]() |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| perl regex string match issue..kindly help | avskrm | Shell Programming and Scripting | 5 | 10-04-2012 08:35 AM |
| print first few lines, then apply regex on a specific column to print results. | kchinnam | Shell Programming and Scripting | 4 | 08-24-2010 03:24 PM |
| awk to print lines based on string match on another line and condition | rowie718 | Shell Programming and Scripting | 5 | 06-14-2010 04:36 PM |
| exact string match ; search and print match | bash_in_my_head | Shell Programming and Scripting | 8 | 05-22-2010 11:41 PM |
| Regex to match when input is not a certain string (can't use grep -v) | kdelok | UNIX for Dummies Questions & Answers | 1 | 02-03-2010 03:45 PM |
|
|