...making Linux just a little more fun!

2-Cent Tips

2-cent Tip: using class of characters in grep

Mulyadi Santosa [mulyadi.santosa at gmail.com]


Wed, 16 Dec 2009 22:59:28 +0700

How do you catch a range or group of characters when using grep? Of course you can always do something like:

$ grep -E '[a-z]+' ./test.txt
to show lines in file "test.txt" that contain at least single character between 'a' to z in lower case.

But there is other way (and hopefully more intuitive...for some people). Let's do something like above, but the other way around. Tell grep to show the name of text files that doesn't contain upper case characters

$ grep -E -v -l '[[:upper:]]+' ./*
Here, upper is another way of saying [A-Z]. Note the usage of double brackets! I got trapped once, thinking that I should only use single bracket and wonder why it didn't work....

There are more classes you can use. Check "info grep" in section 5.1 "Character class"

-- 
regards,
 
Mulyadi Santosa
Freelance Linux trainer and consultant
 
blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

[ Thread continues here (2 messages/2.35kB) ]


2-cent Tip: converting Festival phonesets to Flite

Jimmy O'Regan [joregan at gmail.com]


Tue, 1 Dec 2009 03:29:45 +0000

Obviously, this isn't going to be everyone's cup of tea, but it would annoy me if I ever have to repeat this, or had to tell someone 'oh, I did that once, but forgot the details'.

Festival is a fairly well known as a speech synthesiser, but it's generally better suited as a development platform for voice and language data; Flite is a lightweight TTS system that uses data developed with Festival. Flite has some scripts to help the process, but they're either undocumented or misleadingly documented.

One such script is tools/make_phoneset.scm: the function synopsis gives 'phonesettoC name phonesetdef ODIR', but the actual synopsis is 'phonesettoC name phonesetdef silence ODIR', where 'name', 'silence' and 'ODIR' are strings, 'phonesetdef' is a Lisp list of features. I don't know Scheme or Lisp all that well, so I eventually got it to work by copying the phoneset to a file like this (myphones.scm):

(phonesettoC "my_phoneset"
'(defPhoneSet
  my_phoneset
  ;;;  Phone Features
  (
   (vc + -)
   (vlng s l d a 0)
   (vheight 1 2 3 -)
   (vfront 1 2 3 -)
   (vrnd + -)
   (ctype s f a n l t 0)
   (cplace l a p b d v 0)
   (cvox + -)
   )
 
  (
   (#  - 0 - - - 0 0 -) ;this is the 'silence' phonedef
   (a  + l 3 2 - 0 0 -)
   ; snip
  )
)
 
(PhoneSet.silences "#")
 "outdir")

and converting it with: mkdir outdir && festival $FLITEDIR/tools/make_phoneset.scm myphones.scm

leaves a C file suitable for use with Flite in outdir

1 down, ~12 scripts left to figure out...

-- 
<Leftmost> jimregan, that's because deep inside you, you are evil.
<Leftmost> Also not-so-deep inside you.


2-cent Tip: avoid re-downloading full isos

Rick Moen [rick at linuxmafia.com]


Tue, 1 Dec 2009 11:40:54 -0800

----- Forwarded message from Tony Godshall <tony@of.net> -----

Date: Tue, 1 Dec 2009 10:30:26 -0800
From: Tony Godshall <tony@of.net>
To: conspire@linuxmafia.com
Subject: [conspire] tip: avoid re-downloading full isos 
If you have an iso that fails checksum and a torrent is available, rtorrent is a pretty good way to fix it.

cd /path/to/ubuntu910.iso && rtorrent http://url/for/ubuntu910.iso.torrent

The reason torrent is good for this is that it checksums each block and fetches only the blocks required.

Tony

conspire mailing list conspire@linuxmafia.com http://linuxmafia.com/mailman/listinfo/conspire

----- End forwarded message -----



Talkback: Discuss this article with The Answer Gang

Copyright © 2010, . Released under the Open Publication License unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 170 of Linux Gazette, January 2010

Tux