Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to replace the pattern: \(d+, to (. How can I do that?

Because when I exported db I need to remove the id column which is auto increment.

INSERT INTO `users` VALUES (22,''

(22, should be replace to (NULL,

share|improve this question
up vote 3 down vote accepted

You can try below,

sed "s/([0-9]*,/(NULL,/" [file name]
share|improve this answer
I does not work. – vietean Jan 21 '13 at 3:23
Ah, the SQL is not going to work because the number of column is different. – neo Jan 21 '13 at 3:27
ok, I have edited the answer and it will insert with NULL and use the automated increment value. – neo Jan 21 '13 at 3:28
This makes little sense now! Perhaps one of you could modify the question as well to make more sense? As it stands, it doesn't answer the question, since it both inserts "NULL" and doesn't get rid of the comma. – Sparhawk Jan 21 '13 at 5:27
@neo Thanks! And good effort to work out the real question in the first place. – Sparhawk Jan 23 '13 at 1:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.