Reg expressions


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Reg expressions
# 1  
Old 01-18-2011
Reg expressions

Hi,
I would like to grep for a string within a tag, can someone provide some assistance in how to do it? So I would like to use the grep command to find a string like:

<tag>sometext<tag>

because the sometext can be any number of characters or an type of number or lettering, what expression is best to use?

Thanks
# 2  
Old 01-18-2011
If its relatively simple:
Code:
egrep "<tag>.*<tag>"

may well work.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Going mad on an egrep command (Reg Expressions)

Dear community, I am trying for several hours now to create an egrep command to grep the number of lines containing a specific text from a text-file but seem to have an error somewhere. The Textfile contains several thousand lines and has the expression "Lastname" in several lines.... (3 Replies)
Discussion started by: Donzo
3 Replies

2. Shell Programming and Scripting

Problems with reg.-expressions in a awk-search-pattern

Hi, i have some problems with regular expressions in a awk search pattern. what i want to do: i want to calculate the mean-value in the time from 00:00 to 06:00 how my data looks like: .... 04/01/13-01:40 670992 54802 80711 116460 156177 04/01/13-01:50 703725 60150 85498 ... (3 Replies)
Discussion started by: IMPe
3 Replies

3. Shell Programming and Scripting

Bash script - coloring reg. expressions in text

Hi all, is there anyone good at bash who will help me? I need to use syntax ${string/pattern/replacement} The problematic part where I am stuck is: #!bin/bash text="A cat is on a mat." exp="cat" newexp="SOMECODEcatSOMECODE" newtext=${${text}/${exp}/${newexp}} == > ERROR "wrong... (4 Replies)
Discussion started by: JohnnyM77
4 Replies

4. Shell Programming and Scripting

Help with regular expressions

I have a file that I'm trying to find all the cases of phone number extensions and deleting them. So input file looks like: abc x93825 def 13234 x52673 hello output looks like: abc def 13234 hello Basically delete lines that have 5 numbers following "x". I tried: x\(4) but it... (7 Replies)
Discussion started by: pxalpine
7 Replies

5. Shell Programming and Scripting

Regular expressions help

need a regex that matches when a number has a zero (0) at the end of it so like 10 20 120 30 330 1000 and so on (6 Replies)
Discussion started by: linuxkid
6 Replies

6. UNIX for Dummies Questions & Answers

Unix Expressions

Hi to all, this is my first time in the forum...and I know some basic's about UNIX... I want to write an expression to validate a field. field is varchar2, length is 5, can be from '00001' to '99999'. no loops or if condition, just check the value if between these two numbers it is OK if it is... (2 Replies)
Discussion started by: 786habeeb
2 Replies

7. UNIX for Dummies Questions & Answers

Combining Expressions

Hi there, I'm having some trouble with a script were I want 2 expressions to evaluate to true before my if loop will continue... if ; then Both these expressions work on their own, but not when combined. What am I doing wrong? Regards davewg :) (6 Replies)
Discussion started by: davewg
6 Replies

8. Shell Programming and Scripting

regular expressions

Hi, can anyone advise me how to shorten this: if || ; then I tried but it dosent seem to work, whats the correct way. Cheers (4 Replies)
Discussion started by: jack1981
4 Replies

9. Shell Programming and Scripting

Regular Expressions

How can i create a regular expression which can detect a new line charcter followed by a special character say * and replace these both by a string of zero length? Eg: Input File san.txt hello hi ... (6 Replies)
Discussion started by: sandeep_hi
6 Replies

10. UNIX for Advanced & Expert Users

SCO vs Linux Reg Expressions Problem

Hi there, I'm investigating migrating a system currently running Scos osr5 to Linux (eg RH 7.2) but there are a lot of in house scripts, some of which are probably using "Sco specific" constructs etc. One I have come across is as follows, if ????? ] then ....etc.etc fi The regular... (2 Replies)
Discussion started by: pcs7088
2 Replies
Login or Register to Ask a Question