Friday, 30 March 2012
Write a shell script to add the statement #include
at the beginning of every C source file in current directory containing printf and fprintf
grep -lw -e "printf" -w -e "fprintf" *.c > $$
for filename in `cat $$`
do
sed '1i\
#include<stdio.h>\
#include<conio.h>
' $filename > $$$
`cat $$$>$filename`
rm $$$
done
rm $$
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment