Substitution with sed

I have a file with some numbers having single quotes around them which I want to remove.

i.e. '923930' -> 23930

If it can be done without using sed thats fine. I have tried with sed but can't think how to replace this pattern on only the numbers

sed 's/\'([0-9]+)\'/$1/g' file

or

sed 's/\'([0-9][0-9]*)\'/$1/g' file
sed "s/'\([-+]\{0,1\}[0-9][0-9.]*\)'/\1/g" file

Thanks, I get the error:

syntax error at line 2: `(' unexpected

also can I ask why `sed 's/\'([0-9])*\'/$1/g' input file` would not work?

You need to use double quotes around the sed script in this case..

sed "s/'\([-+]\{0,1\}[0-9][0-9.]*\)'/\1/g" file works but i was wondering why the other sed command gives me the following error:

 
sed "'s/\'([0-9][0-9]*)\'/$1/g'" newscript2

Unrecognized command: 's/\'([0-9][0-9]*)\'//g'

sed "s/\'([0-9][0-9]*)\'/$1/g" newscript2

instead of

sed "'s/\'([0-9][0-9]*)\'/$1/g'" newscript2

It doesn't appear to take out the quotation e.g.:

 
INSERT INTO PRICE VALUES
   ('100871',4.8,3.2,TO_DATE(2447528,'J'),TO_DATE(2447862,'J'))
go

still is the same

sed "s/'\([0-9][0-9]*\)'/\1/g" file

this should defiantly work.

Thanks that does work

 
sed "s/\'([0-9][0-9]*)\'/$1/g" newscript2

I get "paramter not set" error here.
I guess it should be

 
sed "s/'\([0-9][0-9]*\)'/\1/g" newscript2

Sorry to bring this up again. What does the \1 mean in the substituted string in the following code? :

 
sed "s/'\([0-9][0-9]*\)'/\1/g" 

Also why is it necessary to use two [0-9] for the expression?

[0-9][0-9]* is a poor man's [0-9]+ , it means at least one occurrence (otherwise zero digits is a match too)
\1 is a backreference to the part saves by the first grouping (the stuff in between the escaped parentheses: \( and \) ).

sed 's/[^0-9]//g' file