Re: space problem

Re: space problem

am 27.10.2007 08:40:49 von Cyrus Kriticos

Grant wrote:
> I have a listing of *.jpg files from a digital camera and some of them
> (not all) have a space in the file name.
> I am having problem renaming the files with the space in them .
>
> my first thought was sed s/ /_/g $file but sed doesn't work with 'ls'
>
> how else to write a script that renames a list of jpgs with [[:space:]]
> in it ?

for i in *\ *.jpg; do echo mv -v $i ${i// /_}; done

Without collision test. Check output and then remove "echo".

--
Best | "Richtig ist sicher, dass die katholische Kirche die groesste
regards | transnationale Schwulenorganisation ist."
Cyrus | -- Priester Hermann Kügler im Interview mit Spiegel Online

Re: space problem

am 27.10.2007 08:47:15 von Cyrus Kriticos

Grant wrote:
> I have a listing of *.jpg files from a digital camera and some of them
> (not all) have a space in the file name.
> I am having problem renaming the files with the space in them .
>
> my first thought was sed s/ /_/g $file but sed doesn't work with 'ls'
>
> how else to write a script that renames a list of jpgs with [[:space:]]
> in it ?

for i in *\ *.txt; do echo mv "$i" "${i// /_}"; done

Without collision test. Check output and then remove "echo".

--
Best | "Richtig ist sicher, dass die katholische Kirche die groesste
regards | transnationale Schwulenorganisation ist."
Cyrus | -- Priester Hermann Kügler im Interview mit Spiegel Online

Re: space problem

am 27.10.2007 08:50:46 von Cyrus Kriticos

Grant wrote:
> I have a listing of *.jpg files from a digital camera and some of them
> (not all) have a space in the file name.
> I am having problem renaming the files with the space in them .
>
> my first thought was sed s/ /_/g $file but sed doesn't work with 'ls'
>
> how else to write a script that renames a list of jpgs with [[:space:]]
> in it ?

for i in *\ *.jpg; do echo mv "$i" "${i// /_}"; done

Without collision test. Check output and then remove "echo".

--
Best | "Richtig ist sicher, dass die katholische Kirche die groesste
regards | transnationale Schwulenorganisation ist."
Cyrus | -- Priester Hermann Kügler im Interview mit Spiegel Online

space problem

am 27.10.2007 21:16:12 von grant

I have a listing of *.jpg files from a digital camera and some of them
(not all) have a space in the file name.
I am having problem renaming the files with the space in them .

my first thought was sed s/ /_/g $file but sed doesn't work with 'ls'

how else to write a script that renames a list of jpgs with [[:space:]]
in it ?


thanx

Grant

Re: space problem

am 28.11.2007 00:02:36 von sputnick

Cyrus Kriticos a écrit :
>
> Grant wrote:
>> I have a listing of *.jpg files from a digital camera and some of them
>> (not all) have a space in the file name.
>> I am having problem renaming the files with the space in them .
>>
>> my first thought was sed s/ /_/g $file but sed doesn't work with 'ls'
>>
>> how else to write a script that renames a list of jpgs with
>> [[:space:]] in it ?
>
> for i in *\ *.jpg; do echo mv "$i" "${i// /_}"; done
>
> Without collision test. Check output and then remove "echo".
>

For this I use :

rename 's/ /_/g' *.jpg