SED to replace lines containing...


I need a sed line that will find all lines that contain “” and then replace the entire line (not just that one string) with “8223”.


I cannot help you with a Sed solution. Maybe others will post that one.
I can however help you with a Ruby script.

As always, test on dummy data to make sure everything is working as
you expect.

set rubyFilePath to quoted form of "/path/to/ruby_file.rb"
set sourceFilePath to quoted form of "/path/to/source_file.txt"
do shell script "/usr/bin/ruby " & rubyFilePath & space & sourceFilePath

Ruby script



Thanks Craig, will try it out :slight_smile: