Suppose I have this code :
int main () { int i = NULL; /* incorrect */ return 0; }
and I want to put the word
between the two parentheses
like this :
int main (void) { int i = NULL; /* incorrect */ return 0; }
which command is used to do it in Linux ?
If you have the code in
/tmp/test.c
, try
sed -e "s/()/(void)/" /tmp/test.c
to see/preview it and
sed -i.bak -e "s/()/(void)/" /tmp/test.c
for an in-place substitution within the file. If anything goes wrong,
/tmp/test.c.bak
should have the original that you started with.
RudiC
3
What keeps you from using a plain text editor like vi
, emacs
, joe
, ed
, or ex
?