* Re: How to edit filenames in rc scripts without sed
@ 1993-08-16 16:30 Steve_Kilbane
0 siblings, 0 replies; 3+ messages in thread
From: Steve_Kilbane @ 1993-08-16 16:30 UTC (permalink / raw)
To: broman; +Cc: rc
For the (vaguely frequent) mv and cp commands, i use specialised commands
that allow wildcards, called 'move' and 'copy':
; mv '*.c' '*.c.old'
for anything else, i'm into the once-per-month-if-that kind of command, and
using sed's quicker than thinking about it:-).
steve
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to edit filenames in rc scripts without sed
@ 1993-08-16 17:08 Alan Watson
0 siblings, 0 replies; 3+ messages in thread
From: Alan Watson @ 1993-08-16 17:08 UTC (permalink / raw)
To: rc
I concur with Steve.
However, I would like to point out one possible problem with basename
in this regard -- many basename executables are /bin/sh scripts which
call expr three times. On my machine, the difference in speed between
the /bin/sh-based system basename and the pure-binary GNU basename is a
factor of 4 (which is the difference in the number of fork/exec
pairs).
Anything based on ifs separation will probably come to grief on file
names containing repeated dots, such as `foo..bar'.
Alan.
^ permalink raw reply [flat|nested] 3+ messages in thread
* How to edit filenames in rc scripts without sed
@ 1993-08-16 16:19 Vincent Broman
0 siblings, 0 replies; 3+ messages in thread
From: Vincent Broman @ 1993-08-16 16:19 UTC (permalink / raw)
To: rc
One of the csh features I find useful, and don't know how
to emulate easily in rc, is the variable substitution with
modifiers. This lets you edit filenames to a certain degree
without execing sed all over the place. E.g. undoing patches with:
foreach f (*.orig)
mv $f $f:r
end
is nicer than
for ( f in *.orig ) mv $f `{echo $f | sed -e 's/\.[a-z]*$//'}
I've tried thinking up ways to get this effect by manipulating
the IFS to include '.' but I still get `{echo $f| ...stuff... }
Any ideas how to do basic filename modifications cleanly in rc?
Vincent Broman, code 572 Bayside Phone: +1 619 553 1641
Naval Command Control and Ocean Surveillance Center, RDT&E Div.
San Diego, CA 92152-6147, USA Email: broman@nosc.mil
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1993-08-16 17:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-08-16 16:30 How to edit filenames in rc scripts without sed Steve_Kilbane
-- strict thread matches above, loose matches on Subject: below --
1993-08-16 17:08 Alan Watson
1993-08-16 16:19 Vincent Broman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).