Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi Experts:
I would like to do a wild card subtitution on a file. In this file, it contains these:
.f(we_rtf123_orty4);
.f(rf_RED_234_p23455oi);I would like to global replace all the characters inside with blank. i.e f(we_rtf123_orty4); with .f( );
I need to use wild card since I have so many lines I need to replace and each of the word are unique and the word length are different in size. Any help you can provide is greatly appreciated.
Thanks,
gotme

Thanks for the reply lankryt0. Unfortunatley, I go this message
sed: command garbled: s/(.*)/( )ggotme

Thanks for catching the error. A bit better but not what I want.
It is replacing all the word inside the bracket to blank but it also remove the .f. I want it to be like .f() not ().Thanks.

strange, when I run the command, that is what I get:
user@machine:~/test> sed "s/(.*)/( )/g" < infile .f( ); .f( ); .f( ); .f( ); .f( ); .f( ); user@machine:~/test> sed --version GNU sed version 4.0.9Infile looks like:
.f(we_rtf123_orty4); .f(rf_RED_234_p23455oi); .f(we_rtf123_orty4_asdf); .f(rf_RED_234_p23455oi_sdasd); .f(we_rtf123_orty4_we_rtf123_orty4); .f(rf_RED_234_p23455oi_we_rtf123_orty4);

Thanks lankrypt0! It works after I ran it again. Don't know what happened. I appreciated all your assistance.
Gotme

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |