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

Re: echo/sed combination inserts extra characters



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/18/06 11:39, Jesus Arocho wrote:
> I want to rename a series of photo files downloaded from a camera; the intent 
> is to append the date to the beginning of the file name.  The relevant lines 
> are:
> 
> newdir=`date +%F | sed 's/-//g'` #newdir used to make the directory and to 
> rename the files.
> 
> new=̈́`echo $i | sed -e 's/_//'` # strip the current file name of the underline 
> in the middle dsc_0001.jpg to dsc0001.jpg
> 
> mv -f $i $newdir'_'$new  #rename the current file
> 
> The resulting file name may contain an extraneous character (does not print) 
> located just after the _ ; as if the echo/sed combination had added a 
> character.  The processing continues because the loop is selecting all jpg or 
> nef files, but trying to do something with the file from the command line 
> results in file not found.  I can see the extra character in konqueror.

jhead might fill your needs.

- --
Ron Johnson, Jr.
Jefferson LA  USA

Is "common sense" really valid?
For example, it is "common sense" to white-power racists that
whites are superior to blacks, and that those with brown skins
are mud people.
However, that "common sense" is obviously wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFX0vyS9HxQb37XmcRAvhYAJ4youalyEhegKRyroVr1yeM6WtCIACg0/pV
hrQjbDzImcpgySLju4f9rfs=
=9LhL
-----END PGP SIGNATURE-----



Reply to: