tags:

views:

261

answers:

3

I read the tutorial which advises me to run at util-linux package

./configure

I get

configuring util-linux-2.12q

You don't have <scsi/scsi.h>
You don't have <linux/blkpg.h>
You don't have <linux/kd.h>
You have <locale.h>You have <langinfo.h>
You have <sys/user.h>
You have <uuid/uuid.h>
You have <rpcsvc/nfs_prot.h>
You don't have <asm/types.h>
You don't have <linux/raw.h>
You have <stdint.h>
You don't have <sys/io.h>
You have inet_aton()
You have fsync()
You have getdomainname()
You have nanosleep()
You don't have personality()
You don't have updwtmp()
You have fseeko()
You have lchown()
You don't have rpmatch()
You have <term.h>
You have ncurses. Using <ncurses.h>.
You have termcap
You don't need -lcrypt
Strange... Static compilation fails here.
You don't have native language support
You have __progname
You don't have <pty.h> and openpty()
You have wide character support
You don't have SYS_pivot_root
You have a tm_gmtoff field in struct tm
Your rpcgen output does not compile - using pregenerated code
You have zlib
You don't have blkid

It then advises me to run the following command at misc-utils

make rename

I get the following warning

cc -pipe -O2 -mtune=i386 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -DNCH=1   -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" -O2  -s  rename.c   -o rename
ld warning: option -s is obsolete and being ignored

How can you install rename -command for Mac?

A: 

Can you not just use mv instead of trying to compile rename? Maybe even alias it to rename?

(EDIT: Ignore my comment about build-essentials - as pointed out by yangyang, it looks like it should have built ok anyhow)

Colin Pickard
@Colin: I am trying to change the names of my files at my Git-repo, such that I can use fileMerge -tool, since they cannot read dot files.
Masi
You should be able to change the names with mv. Maybe I don't understand - is rename used in a script for Git or something?
Colin Pickard
@Colin: I have not managed to do that with mv safely.
Masi
@Colin: rename is used to rename different files easily. It is much easier to rename many dot files with it, than with mv.
Masi
+3  A: 

That's a warning, not an error.

I've just tried this myself and it has built a rename executable.

yangyang
How did you manage to do it? I run unsuccessfully: ./rename File1 Neww, but it does not change the file name.
Masi
It works fine, but you need to read the man page: rename takes three arguments.Example usage:% touch testrename% touch testrename2% lstestrename testrename2% ../rename test different *% lsdifferentrename differentrename2%
yangyang
I did exactly the same as you in trying to use the command. How did you installed the app?
Masi
Please paste in your command and output.
yangyang
@yangyang: Thank you for your answer! The problem was in the use of wrong package. Your pieces of advice work for util-linux-2.12p.
Masi
A: 

Try this:

function rename { from=$1; to=$2; shift 2; for i in "$@"; do j=`echo $i | sed "s/$from/$to/"`; mv "$i" "$j"; done }

Paste it into your .profile or .bashrc and run it just like the Red Hat rename utility:

$rename foo bar *.txt

Turns foo1.txt, foo2.txt and foofoo.txt into bar1.txt, bar2.txt but, somewhat irritatingly, barfoo.txt.
Maybe someone can tweak it to fix this.

Test it by putting 'echo' before 'mv' so that it outputs a list of all changes it will make without making them.

Jangari
Although, Red Hat's rename utility, and zsh workarounds, also mentioned around the place, als have the same behaviour whereby foofoo.txt -> barfoo.txt after running rename foo bar *.txt. So perhaps this isn't a problem if emulating a better rename utility is the point.
Jangari