Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 420
  • Last Modified:

shell script to change value inside files


On Solaris 10
I have 1000 files with a few lines in each one of them.
I need to change the word LOGGING to NOLOGGING.
Can some one, please, post the script to do so.
It has to be done only once and the string LOGGING will only apear once in each line.

1 Solution
sed 's/LOGGING/NOLOGGING/' filename > filename.new
mv filename.new filename

Should change LOGGING to NOLOGGING in one file. To use these commands on 1000 files, a loop would be needed. Is there a pattern for the files in which the changes needs to be done...like they all exist in a directory or have a particular filename pattern etc.

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now