1

I would like to replace the value varchar(36) with char(36) in a file by using sed. I am trying with

sed -i ’s/varchar(36)/char(6)/g’ calls_contacts.sql

But the command does not execute. What am I doing wrong?

2
  • You have one ' missing, and i'm not sure what the second -i does. Also you are escaping the ( but you are not in extended regular expression mode.
    – LatinSuD
    Jul 7, 2014 at 16:35
  • Yeah, apparently copying the command from Evernote to the ssh prompt really messed up the command. It worked simply with sed -i ’s/varchar(36)/char(6)/g’ calls_contacts.sql
    – MaPi
    Jul 7, 2014 at 16:40

1 Answer 1

2

I guess what you want to do is:

sed -i 's/varchar(36)/char(36)/gi' calls_contacts.sql

I corrected 3 things:

  • Closed the '
  • Replaced the second -iwith gi. I suppose you want to ingore case and be global.
  • I unescaped the parenthesis ( as they don't need escaping (must not be escaped) in normal mode.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .