home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!sunic!chalmers.se!biorn
- From: biorn@phc.chalmers.se (Bjorn Sandell)
- Newsgroups: comp.unix.questions
- Subject: Re: Changing file names
- Message-ID: <13549@chalmers.se>
- Date: 20 Aug 92 08:41:29 GMT
- References: <ac#n06l.bosak@netcom.com>
- Sender: news@chalmers.se
- Organization: Dep. of Phys. Chem. Univ. of Gothenburg Sweden
- Lines: 29
-
- In article <ac#n06l.bosak@netcom.com>, bosak@netcom.com (Jon Bosak) writes:
- |>
- |> Here's a problem that must be very common but doesn't seem to get
- |> discussed in books for Unix novices.
- |>
- |> Suppose I have a directory containing files named, for example,
- |>
- |> xyz920815a
- |> xyz920815b
- |> xyz920816
- |>
- |> ...and so on. I want to change the names of these files to
- |>
- |> 920815a
- |> 920815b
- |> 920816
- |>
- |> Who can provide the most elegant solution using just the basic Unix
- |> tools (cp, mv, sed, awk, sh, csh)?
-
-
- Why not use ksh?
-
- for file in xyz* ; do
- mv $file ${file#xyz}
- done
-
-
- Bjorn
-