The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
To identify filename in which having match PATTERN cedrichiu Shell Programming and Scripting 14 03-23-2008 08:05 PM
Print last occurrence if first field match Raynon Shell Programming and Scripting 9 03-13-2008 03:28 AM
match field between 2 files phamp008 Shell Programming and Scripting 8 01-23-2008 07:46 AM
how to use pattern match with grep rei UNIX for Dummies Questions & Answers 5 01-05-2007 04:33 AM
pattern match and substitution, can you help? frustrated1 Shell Programming and Scripting 4 02-20-2006 08:48 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 06-03-2008
someone123 someone123 is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 3
how do i pattern match a field with awk?

hi,

let's say $numbers = "324 350 587" an so on...
what i'm trying to do is this:

awk -v numbers="$numbers" '{if (numbers ~ /$2/) print $0, "bla bla"}' file

# file looks like this:
214 .....
215 ...
216 ....
250
...
324
325
...
350 something ...
...
587 ...

i want to do something with the lines that contain the numbers in the variable numbers, and something else with the lines that match other patterns.

thanks..
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:25 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0