#! /bin/bash ## This shell scripts searches all .dat files in the present directory, and then append ## the content of each .dat file into a target file called targetfile. #mydir="$(echo $(pwd))" numfiles=1000 #number to process find -name "*.dat" -printf "%T@\t%p\n" | sort -k1,1n | tail -$numfiles | cut -f2- | while read file; do echo processing $file cat $file >> targetfile done