scripting - A shell script to read the content of the file under folders and write them into a text file -


i have 53000 folders (named numbers 1,2,3 ...) inside each of there single file called "prop". need collect data them single text file. used command. of folders have blank "prop" file. need know blank in text file.

#!/bin/sh a=0 while [ $a - le 53000]  a= 'expr $a + 1' cat $a/prop >> x.txt done 

this copy contents of existing prop files x.txt. put messages detailing missing files in missing.txt:

cat {1..53000}/prop >x.txt 2>missing.txt 

if, example, file 515/prop missing, there line in missing.txt stating:

cat: 515/prop: no such file or directory 

this requires bash or other advanced shell supports brace expansion.


Comments