The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Perl: Match a line with multiple search patterns Juha Shell Programming and Scripting 10 04-09-2008 02:43 AM
How to cut multiple patterns from a file? Vijay06 Shell Programming and Scripting 5 11-26-2007 09:38 PM
Grep for Multiple patterns WillImm123 Shell Programming and Scripting 7 03-01-2006 04:23 PM
Grep multiple patterns malaymaru Shell Programming and Scripting 4 09-25-2005 02:20 AM
grep for multiple patterns tselvanin UNIX for Dummies Questions & Answers 1 11-12-2003 07:43 PM

Closed Thread
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
  #1 (permalink)  
Old 05-04-2008
Plavixo Plavixo is offline
Registered User
  
 

Join Date: May 2008
Posts: 1
AWK: Multiple patterns per line

Hi there,

We have been given a bit of coursework using awk on html pages. Without giving too much away and risking the wrath of the plagerism checks, I can say we need to deal with certain html elements.

There may be several of these elements on one line. My question is, if there are more that one of these <tags> on a line, will awk pattern match the first one, perform the actions and then ignore the rest of the line? Or will it match the pattern, perform the action and then start where it left off, part way through the line?

If it does skip the rest of the line, how can I impliment a solution that will look at all the elements on a line?

Thank you for your help,
Plavixo
  #2 (permalink)  
Old 05-05-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,789
We do not do homework, but perl regexp's allow multiple searches and you can use sed's
's/<regexp>/something else/g' for global replacement. In awk you probably want a loop

Code:
while (match($0, <regexp>) )
{
   $0="somechange"  "old part of of $0 that you did not change "
}

Closed Thread

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 08:47 PM.


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