[ILUG] Strip first three characters from filename
john Moylan
john at nuatech.net
Sun Aug 10 21:32:46 IST 2008
Hi ollie,
This should work.
for i in `ls *.mp3`; do mv ${i} `echo ${i} | sed 's/_//g'`; done
John
echo hjhj_jkjk_dd | sed 's/_//g'
2008/8/10 <ollie at eillo.org>
>
> I have rename and come across some solutions using it (and others) on
> google but while I'm extremely comfortable on the command line i rarely need
> command this complex. I was unable to adapt any of the web solutions to my
> needs.
>
> How could I use rename to convert underscores in a filename to spaces?
>
>
>
> On Sun, 10 Aug 2008 12:21:33 +0100, "Steve McConville" <
> mcconville.steve at gmail.com> wrote:
> > For future reference there's a perl program called 'rename' which -
> > depending on distro - you may already have installed. It just uses
> > regexps, so
> >
> > rename 's/^\w{3}//' *.mp3
> >
> > would do what you want. John's solution using cut is more portable,
> > however.
> >
> >
>
> --
> Irish Linux Users' Group mailing list
> About this list : http://mail.linux.ie/mailman/listinfo/ilug
> Who we are : http://www.linux.ie/
> Where we are : http://www.linux.ie/map/
>
More information about the ILUG
mailing list