rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: broman@peanuts.nosc.mil (Vincent Broman)
To: rc@hawkwind.utcs.toronto.edu
Subject: How to edit filenames in rc scripts without sed
Date: Mon, 16 Aug 1993 12:19:04 -0400	[thread overview]
Message-ID: <9308161619.AA16787@trout.nosc.mil> (raw)

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

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

             reply	other threads:[~1993-08-16 16:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-08-16 16:19 Vincent Broman [this message]
1993-08-16 16:30 Steve_Kilbane
1993-08-16 17:08 Alan Watson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9308161619.AA16787@trout.nosc.mil \
    --to=broman@peanuts.nosc.mil \
    --cc=broman@trout.nosc.mil \
    --cc=rc@hawkwind.utcs.toronto.edu \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).