When doing the grep
recursive command to search a string within files:
grep -r "height:" *.txt
aaa.txt:height: 15
bbb.txt:height: 12
ccc.txt:height: 17
Can we safely assume that grep will always list files in the same order (i.e. alphanumeric) each time?
.txt
and all files in directories ending in.txt
. The order of the files (if no matching directories found), is determined by bash. bash expands the*.txt
and passes the list to grep. Try echo*.txt
. bash will do all the work, echo does next to nothing. – ctrl-alt-delor Nov 23 '18 at 23:43