[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] sed, start af fil navne



On Thu, 27 Mar 2008, Hans Ole Hansen wrote:

Jeg har nogle filer sally-r1, sally-r10, harry-r100, harry-r2

Jeg vil gerne generere en liste hvor de første tegne fra filnavnet
indtil -r[0-9]+ optræder kun engang.
I ovennævnte eksempel skulle listen i såfald blive

sally
harry

Hvordan gør jeg det. Jeg tror at jeg skal bruge noget lign

ls | sed 's/\(.+\)r[0-9]+/\1/' | sort -u

Du mangler \ foran + og et ekstra -, dvs.:

   ls | sed 's/\(.\+\)-r[0-9]\+/\1/' | sort -u

- Jens
--
http://imada.sdu.dk/~svalle/address.php
Stop destroying our planet!
This is where I keep all my stuff.


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2008-04-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *