HP3000-L Archives

December 2001, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Ken Hirsch <[log in to unmask]>
Reply To:
Ken Hirsch <[log in to unmask]>
Date:
Thu, 13 Dec 2001 19:51:23 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (37 lines)
sed  's/oldstring/newstring/' oldfile >newfile

If the newfile does not exist before, the shell will of course create a
bytestream file.  If you want it to have the same characteristics as the
oldfile, the easiest thing to do is:
callci copy oldfile, newfile
before the sed
You can
mv newfile oldfile
after the sed to have it replace the old file.

If the file is numbered this will have a bad effect (unless the length of
oldstring and newstring are the same).


----- Original Message -----
From: "Peter Osborne" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Thursday, December 13, 2001 5:06 PM
Subject: String Replacement


> Hello All,
>
> Does anyone know a quick way, with shell script to replace a given string
> with another string in an ASCI or Bytestream file?
>
> Thanks,
> -Pete
>
> * To join/leave the list, search archives, change list settings, *
> * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
>

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2