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

Re: [OT] aiuto in bash



On Mon, 22 Dec 2008 16:01:25 +0100, Sandro Tosi wrote:

> Fa abbastanza schifo, ma dovrebbe andare (si poteva usare anche awk,
> or python, ma rimanianmo con la roba semplice):
> 
> $ echo $frase | sed 's/oggi/oggi\n/g' | grep -c 'oggi'

Che, a differenza della mia "implementazione", conta anche "oggidomanioggi"
come 2 (e non 1).

Inoltre non conoscevo -c di grep (potevo quindi evitarmi il pipe a wc -l :) ),
grazie morph! :)

David

-- 
 . ''`.  Debian maintainer | http://wiki.debian.org/DavidPaleino
 : :'  : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'`  GPG: 1392B174 ----|---- http://snipr.com/qa_page
   `-   2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174

Attachment: signature.asc
Description: PGP signature


Reply to: