Read multiple text file in shell sccript

view full story

http://www.unix.com – I need help. I need to read all current and incoming text file in the directory and change it's content to 0. The following code change the content of the text file to 0, however, the code always assumes that the files are ALREADY present. Is there any way where I can change the file1_.txt, file_2.txt, file_3.txt with only .txt extension and still change the content of the .txt file #!/bin/sh for file in file_1.txt file_2.txt file_3.txt do awk '{ print "0" }' $file > tmp.tmp mv tmp.tmp $file done Thanks for the help! (HowTos)