Solved

Many Files - Change

Posted on 1997-05-02
3
175 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
3 Comments
 

Accepted Solution

by:
fsgreen earned 100 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
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 how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

757 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now