Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to replace the specific numbers and use this command:

sed -e 's/[0-9]\{12\}/ /g' file.log

but nothing happens. As U can see this expression should replace all numeric occurrences with size of 12 digits, globally and replace it with space. I found out that the {, } symbols should be escaped - weird. It doesn't work. Please help.

share|improve this question

migrated from stackoverflow.com Mar 5 '13 at 9:09

This question came from our site for professional and enthusiast programmers.

    
Works for me. Can you show a sample input? –  choroba Mar 5 '13 at 8:23
    
It works fine for me. Which Linux version are you using? –  mvp Mar 5 '13 at 8:23
    
when I type echo 1224512561234 | sed -e 's/[0-9]\{12\}/ /g' i got response ` 4`. It seem to me to be correct. –  V-X Mar 5 '13 at 8:23
3  
As others have pointed out it appears to work fine.. That won't edit the content of the file itself though. If that's what you're trying to do you can try the -i option for sed see man sed (unixhelp.ed.ac.uk/CGI/man-cgi?sed) –  rvalvik Mar 5 '13 at 8:35
add comment

Your Answer

 
discard

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