[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnu-arch-users] Example: renaming files and files references within
From: |
Miles Bader |
Subject: |
Re: [Gnu-arch-users] Example: renaming files and files references within arch |
Date: |
Thu, 9 Sep 2004 18:46:09 -0400 |
User-agent: |
Mutt/1.3.28i |
On Thu, Sep 09, 2004 at 03:10:52PM +0000, Mark Stosberg wrote:
> Any suggestions for easier ways to accomplish these steps (especially the
> first?
When I have to do this sort of thing I usually use sed to spit out a `shell
script', which I can check for correctness, and then feed to `sh -v' for
execution.
E.g.,:
tla inventory -s | sed -n "s/\(.*\)\.tmpl\$/tla mv '&' '\1.html'/p"
For checking and,
tla inventory -s | sed -n "s/\(.*\)\.tmpl\$/tla mv '&' '\1.html'/p" | sh -v
for execution.
The sed `-n' option, and the "p" appended to the s/// command cause sed to
delete any input lines that don't get substituted; one could also just omit
them, and use an additional "grep ..." before the sed.
Note the use of '...' quoting around the filenames in the output to guard
against shell quoting problems with odd filenames (and thus the use of "..."
quoting to quote the sed commands and the subsequent escaping of sed $
meta-character).
-Miles
--
Freedom's just another word, for nothing left to lose --Janis Joplin
- [Gnu-arch-users] Example: renaming files and files references within arch, Mark Stosberg, 2004/09/09
- Re: [Gnu-arch-users] Example: renaming files and files references within arch, Jani Monoses, 2004/09/09
- Re: [Gnu-arch-users] Example: renaming files and files references within arch, David Allouche, 2004/09/09
- Re: [Gnu-arch-users] Example: renaming files and files references within arch, Gergely Nagy, 2004/09/09
- Re: [Gnu-arch-users] Example: renaming files and files references within arch, Aaron Bentley, 2004/09/09
- Re: [Gnu-arch-users] Example: renaming files and files references within arch, Stig Brautaset, 2004/09/09
- Re: [Gnu-arch-users] Example: renaming files and files references within arch,
Miles Bader <=