Re: how to change suffix for many files?

From: Icarus Sparry (usenet_at_icarus.freeuk.com)
Date: 03/10/05


Date: Thu, 10 Mar 2005 05:31:41 GMT

On Thu, 10 Mar 2005 00:02:19 -0500, Dave Stewart wrote:

> Suppose there are many files with suffix 'jpg' and I want to change the
> suffix to 'tif'.
> How can I do it in Unix? I try to use the following command,
>
> find . -name "*.jpg" | sed -e 's/\(.*\.\)jpg/mv \1jpg \1tif/' | xargs
>
> but it does not work. Could you please tell me what is wrong with the
> command?

Almost perfect. Feed it to 'sh' rather than 'xargs'.

> Is there any other way to do this? Thanks in advance!
Yes. 'mmv', perl, other forms of loops. A 3 second web search turned up
http://kb.indiana.edu/data/abec.html which claims to come from the FAQ.

However you have a good solution, so stick with it.



Relevant Pages

  • Re: vi horizontal split screen
    ... Command line recall and edit, which I had on DOS, was worth the price of admission by itself. ... The script language was designed to look like C for the benefit of C programmers working on *nix, but you still needed to know Bourne syntax, because all the scripts that controlled Unix itself were in the Bourne shell language. ... Emacs is not it. ... The default Emacs keystrokes have the same basic characteristic as the default vi keystrokes and the default WordStar command set: they are keyboard independent. ...
    (comp.editors)
  • Re: Sarahs very sad...
    ... There is a core of a Unix OS in the foundations, ... It is a considerable wrench going from a GUI to a program whose interface ... Linux or Unix system without ever seeing a command line or a config file ...
    (uk.people.support.depression)
  • Re: Data conversion EBCDIC to ASCII
    ... When you enter the omvs command, you are placed into UNIX; ... Data conversion EBCDIC to ASCII ... window into a text editor on your workstation ...
    (bit.listserv.ibm-main)
  • Re: Why isnt OMVS command integrated with ISPF?
    ... Why isn't OMVS command integrated with ISPF? ... What you would like is a multithreaded (multiple TCBs under z/OS) ISPF ... the UNIX command. ...
    (bit.listserv.ibm-main)
  • how to change suffix for many files?
    ... Suppose there are many files with suffix 'jpg' and I want to change the ... suffix to 'tif'. ... How can I do it in Unix? ... I try to use the following command, ...
    (comp.unix.shell)