The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
A simple find and replace without using any regex (bash) srikanths Shell Programming and Scripting 2 03-18-2008 08:08 AM
Regex deepakpv Shell Programming and Scripting 6 03-28-2007 04:18 AM
Regex?? Please help lunac UNIX for Dummies Questions & Answers 7 01-30-2007 01:13 PM
find -regex: matching multiple extensions r0sc0 Shell Programming and Scripting 2 12-08-2005 02:32 PM
sed regex Shakey21 UNIX for Dummies Questions & Answers 4 01-31-2002 09:16 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-27-2008
trek trek is offline
Registered User
  
 

Join Date: Apr 2008
Location: Austria
Posts: 9
Post dont't find right regex

I have a string which contains following information:

Code:
<SZ.T><P ALIGN="CENTER"><FONT FACE="Arial, Helvetica, sans-serif" SIZE="+3">Bundesregierung nimmt sich dicke Deutsche vor</FONT></P></SZ.T>
<SZ.UT><P ALIGN="CENTER"><FONT SIZE="+1"><I> Seehofer und Schmidt planen Kampagne gegen &Uuml;bergewicht </I></FONT></P></SZ.UT>
now i want to find:
"Bundesregierung nimmt sich dicke Deutsche vor"
" Seehofer und Schmidt planen Kampagne gegen &Uuml;bergewicht "

I tried "
Code:
foreach ($x =~ /<.*?>(.*)<.*?>/g) {print "%"x3 .$1."\n";}
" but then i get:
%%%<P ALIGN="CENTER"><FONT SIZE="+1"><I> Seehofer und Schmidt planen Kampagne gegen &Uuml;bergewicht </I></FONT></P>
%%%<P ALIGN="CENTER"><FONT SIZE="+1"><I> Seehofer und Schmidt planen Kampagne gegen &Uuml;bergewicht </I></FONT></P>

the regex should ignore ><, because there is no information between ><, and find every information with is between ><, f. e. >Bundesregierung<

can anyone help me? thx

can anyone help me.
  #2 (permalink)  
Old 05-27-2008
Klashxx's Avatar
Klashxx Klashxx is offline Forum Advisor  
HP-UX/Linux/Oracle
  
 

Join Date: Feb 2006
Location: Almerķa, Spain
Posts: 393
Try:
Code:
sed -e "s/<[^<]*>//g" file
  #3 (permalink)  
Old 05-27-2008
trek trek is offline
Registered User
  
 

Join Date: Apr 2008
Location: Austria
Posts: 9
yeah, amazing, it works!

but do you also know the regex to match the information which i am looking for and not delete the information which is useless?

why does
Code:
/>([^<]*)</g
not work?
  #4 (permalink)  
Old 05-27-2008
Klashxx's Avatar
Klashxx Klashxx is offline Forum Advisor  
HP-UX/Linux/Oracle
  
 

Join Date: Feb 2006
Location: Almerķa, Spain
Posts: 393
Quote:
Originally Posted by trek View Post
yeah, amazing, it works!

but do you also know the regex to match the information which i am looking for and not delete the information which is useless?

why does
Code:
/>([^<]*)</g
not work?
Very close, here reverse logic goes, use:

Code:
foreach ($x =~ /<.*?>[^<]([^<]*)<.*?>/g ) {print "%"x3 .$1."\n";}
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 05:40 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