Subscribe to Get Free Material Updates!
Visit my new blog WebData Scraping - Web Scraping Service provider company in India.

Write a shell script to add the statement #include at the beginning of every C source file in current directory containing printf and fprintf


clear
grep -lw -e "printf" -w -e "fprintf" *.c > $$
for filename in `cat $$`
do
 sed '1i\
 #include\
 #include
 ' $filename > $$$
 `cat $$$>$filename`
 rm $$$
done
echo "File corrected successfully"
rm $$

Output: 

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes