[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: [TEKNIK] Sletning af filer ud fra liste



Hvis din fil indeholder regexps så som

^filnavn$

så kan du gøre følgende

ls --color=never|grep -v -f patterns |xargs --delimiter "\n" rm

Så hvis dine filer bare indeholde[a-zA-Z_0-9.], så kan du bare sætter ^$
ind i filen (med sed eller en emacs-makro fx), så bør det virke.

Bemærk at med grep's regexps-syntax, så er "." bare ".", mens "\." er en
vilkårlig karakter.

Hilsen Thue

PS: bash shellcode er uhyggeligt grimt og uelegant, fordi alt er strenge og
ikke objekter :(. Jeg har hørt at powershell skulle være pænere.

2013/6/23 Jens Bang <sslug@sslug>

> Jeg har en liste med filnavne, dvs. en ASCII tekst fil med et filnavn på
> hver linie. Jeg har også et directory med en masse filer, bl.a. filerne fra
> listen. Hvordan sletter jeg de filer der IKKE er på listen?
>
> --
>
>         |\     _,,,---,,_       Greetings, Jens
>  ZZZzz /,`.-'`'    -.  ;-;;,_
>       |,4-  ) )-,_. ,\ (  `'-'  sslug@sslug
>      '---''(_/--'  `-'\_)
> ------------------------------**----------------------
> I used to be disgusted, now I try to be amused.
>                                                       -- Elvis Costello
>
>
>


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2013-07-01, 02:05 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] *