[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sed gátur



Hæbb,

Snubbótt svar.. :)

On Wed, Jan 27, 2010 at 15:52, Sigurdur Jonsson <siggijons ( at ) yahoo ( dot ) com> wrote:
> Write a RE to match only words with an even number of letters up to a maximum of 10 letters.

(\w\w){1,5}

> Remove any line that begins or ends with a vowel (a,e,i,o,u).

sed '/^[aeiou]\|[aeiou]$/d'

> Look for every line beginning with a '<'

sed -n '/^</p'

> Hverja linu sem er með <div>, case-insensitive

sed -n '/<div>/Ip'

> Look for all references to QED. Number each line you find.

sed -n '/QED/=; /QED/p'

> Show all lines that are headings (H1, H2, H3, etc.). Again case may be an issue.

sed -n '/<h[1-7]>/Ip'


Mæli annars með þessari:
http://regex.info/index.html

kv,
Arnar