[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] Vælg tilfældig fil i Bash



Peter Maersk-Moller <sslug@sslug> writes:

> Med gode gamle Sed og Awk kan man faktisk det meste.

Når du nu siger gode gamel awk, hvorfor bruger du så gawk?

> Virker ogsaa med mellemrum i filer og andre spoejse tegn.

Du mener ikke at newline er et spøjst tegn i et filnavn?

  find -type f -print0 | perl -0ne '@a=<>;print "sslug@sslug"'

Virker med alle tilladte spøjse tegn du kan putte i et filnavn. (Nej,
jeg har ikke lige en reference til at NUL ikke kan findes i et
filnavn, korriger mig gerne).

> Virker ogsaa med ingen filer.

Det er perl-løsningen også (for en passende definition).

> Men det er jo lidt snyd. Det er jo ingen ren bash-loesning ;')

Nej, jeg kan desvære ikke umidelbart får bash til at splitte på
NUL-tegn.

-- 
 Peter Makholm     |                                 Wisdom has two parts:
 sslug@sslug |                           1) having a lot to say, and
 http://hacking.dk |                                      2) not saying it


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:43 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] *