Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Many Files - Change

Posted on 1997-05-02
3
Medium Priority
?
192 Views
Last Modified: 2010-04-21
I am using C-shell .

I would like to change the contents of many files at once
i.e. change say the occurrence of 'xyz' in many files to
'abc' .
All the files are in one directory .

I guess I need to create an executable file - I've tried one
starting with '# /bin/csh -f' and this works OK .

Thanks - Brian Roberts
0
Comment
Question by:BlueFin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Accepted Solution

by:
fsgreen earned 200 total points
ID: 2006259
here's a script that will do it:

#!/bin/csh
foreach i (*)
sed s/"xyz"/"abc"/ < $i > tempfile
mv tempfile $i
end

      doug.
0
 

Author Comment

by:BlueFin
ID: 2006260
This is the first time I've used experts-exchange and the
answer I have received solves my problem .
I am very pleased with this .
I am not sure about your grading system re
excellent and good - as I don't know how easy my
question was to answer for an expert .
0
 

Expert Comment

by:smagt
ID: 2006261
There also exists a program called "fgres" - fast grep and substitute, available from several ftp servers.
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question