[mythtv-users] Bash Script help please

Dylan Semler dylan.semler at gmail.com
Tue Oct 10 17:42:52 UTC 2006

On 10/10/06, Jeff volckaert <jvolckaert at gmail.com> wrote:
> Hello Everybody,
> I am trying to create a script to transcode files for a PDA.  I am
> trying to save the file with the filenanme as TITLE-STARTTIME.avi.
> I'm trying to remove non-alphanumeric chars in TITLE and am stuck.  I
> thought the following script code would work for 'Will & Grace', but
> it doesn't.
> # Remove non-alpha characters from TITLE
> [[ $TITLE =~ s/[^a-zA-Z0-9]//g ]]
> echo $TITLE
> I still get 'Will & Grace' instead of 'WillGrace'.

I'm not sure BASH can do such regex substitutions, I've never seen it
before, but I could be wrong.  Instead, why not try it with sed:

TITLE=`echo $TITLE | sed s/[^a-zA-Z0-9]//g`

Type faster.  Use Dvorak:

More information about the mythtv-users mailing list