Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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,'xxx@gmail.com'

(22, should be replace to (NULL,

share|improve this question

1 Answer 1

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

 
discard

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.