Thursday, April 14, 2011

sed: -e expression #1, char 24: unknown option to `s'

When you call sed in ruby, you may get this error message

here is the ruby code

def update_server (conf_file_path, config )
puts "update #{conf_file_path}"
%x[sed "s/drs_db.*\/drs_db/drs_db mmmmmmmm \/drs_db/g" #{conf_file_path}]
end

correct:
def update_server (conf_file_path, config )
puts "update #{conf_file_path}"
%x[sed "s/drs_db.*\\/drs_db/drs_db mmmmmmmm \\/drs_db/g" #{conf_file_path}]
end

1 comment:

  1. This is the only solution Helped for this error .
    Thnx a lot

    ReplyDelete