sed 's:/product/815/:/product/816/:g' crontab.bak

sed 's:/product/815/:/product/816/:g' crontab.bak

Post by James Willia » Sun, 04 Feb 2001 03:19:04



sed 's:/product/815/:/product/816/:g' crontab.bak

I need to change all records in a directory  using something similar
to the above. In the above example STDOUT shows the changes. How can
up update crontab.bak inplace in the above example?

 
 
 

sed 's:/product/815/:/product/816/:g' crontab.bak

Post by John Doher » Sun, 04 Feb 2001 03:27:36


| sed 's:/product/815/:/product/816/:g' crontab.bak
|
|
| I need to change all records in a directory  using something similar
| to the above. In the above example STDOUT shows the changes. How can
| up update crontab.bak inplace in the above example?

Use a temp file, e.g.:

sed 's:/product/815/:/product/816/:g' crontab.bak > foo && mv foo crontab.bak

--

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Posted via Usenet.com * RETENTION * COMPLETION * SPEED *
                http://www.usenet.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

 
 
 

sed 's:/product/815/:/product/816/:g' crontab.bak

Post by Brendon Caligar » Sun, 04 Feb 2001 03:57:20




Quote:> sed 's:/product/815/:/product/816/:g' crontab.bak

> I need to change all records in a directory  using something similar
> to the above. In the above example STDOUT shows the changes. How can
> up update crontab.bak inplace in the above example?

as such you can't.

use ed, perl, or wrap sed into a shell script that uses some
intermediate file.
eg
perl -pi -e 's/foo/bar/g' test

B

Sent via Deja.com
http://www.deja.com/

 
 
 

sed 's:/product/815/:/product/816/:g' crontab.bak

Post by Kurt J. Lanz » Sun, 04 Feb 2001 05:04:10



> sed 's:/product/815/:/product/816/:g' crontab.bak

> I need to change all records in a directory  using something similar
> to the above. In the above example STDOUT shows the changes. How can
> up update crontab.bak inplace in the above example?

You can't. Sed by itself won't update a file in place
correctly no matter how hard you try. Write a script in
which sed writes to a temporary file, then either moves
or copies it to the original.
 
 
 

1. UNIX REVIEW LINUX 'OUTSTANDING PRODUCT OF 1994' AWARD!

  Two really positive mentions in the December 1994 UNIX REVIEW magazine.
  The magazine awarded Linux one of the 'Outstanding Products of 1994'.
  There were 6 catagories: SOFTWARE DEVELOPMENT FRONT END, SOFTWARE
  DEVELOPMENT BACK END, NETWORKING, GROUPWARE, GEM and EDITOR'S AWARD.
  Linux won the GEM award. A bit about the selection process from the
  article:

       The selection process for the awards is not easy. It involves
       nominations, voting, and considerable arguments from numerous
       sources: columnists, the UNIX REVIEW editorial board, staff,
       and previous award winners. When all is said and done, a bare
       handful of products survive the vicissitudes and flames to e-
       merge triumphant as the best products of the year. The judge-
       ment is inherently subjective, as it should be, since we ex-
       pect that the opinion you will form of these products will be
       subjective, too.

  In the same issue in the PC UNIX column the lead article by David
  Bailey is also about Linux with mention of Novell's interest in its
  use.

  I want to take this opportunity to thank Linus Torvalds and the Linux
  community for the work and effort put into producing and excellent
  and fun working environment. Three beers!

  Leo

2. 486 X server serving a couple 386s as clients

3. Any Products for 'blowing' PC Apps onto Solaris Workstation

4. Some questions from a relative Linux newbie...

5. PCWEEK 'Product of the week'

6. /etc/issue no longer used?

7. (sed 1q ; sed 2q) : no output from 2nd 'sed'

8. ld missing C++ library

9. Cracking XP Product Activation, a PC user's license?

10. Duh - Microsoft: "Our products aren't engineered for security"

11. Navisoft's Products

12. sed -e 's/\'a\'/\';\'/' ?

13. New '6000 product announcements via anon. ftp