perform 3 awk commands to multiple files in multiple directories

Dear both, it worked perfectly fine! Thank you!

I've also successfully employed the second awk command within a second while-do-done that is performed after a new find search, the code is as follows:

#!/usr/bin/sh

set -xv

#first find for cust_*.txt files
find /home/tester/datasets_26_10_11/hour_1/ -name "cust_*.txt" -type f | \


while read fname
do
	fileBaseName=`basename "${fname}"`
	fileDirName=`dirname "${fname}"` 

	echo "fileBaseName: [${fileDirName}][${fileBaseName}] - fname[${fname}]"


	echo "now working on: [${fname}] with [${fileBaseName}]"
	
	
	awk -v outputPath="${fileDirName}" 'BEGIN{RS =" ";}{ns=split(FILENAME,arr,"/"); print > outputPath "/" "n_" arr[ns]}' "${fname}" 


done


#start second find for the n_cust_*.txt files

find /home/tester/datasets_26_10_11/hour_1/ -name "n_cust_*.txt" -type f | \

while read fname
do
		fileBaseName=`basename "${fname}"`
		fileDirName=`dirname "${fname}"`
		awk -v outputPath="${fileDirName}" 'FNR>3 {ns=split(FILENAME,arr,"/"); print > outputPath "/" "fin_" arr[ns]}' "${fname}"
done

However it still only works for one single directory...is there a way through the find tool to make this script global for all the hour_*/ directories?

(i'll experiment with it and let you know...if anything comes into your mind you are more than welcome to suggest:) :slight_smile: )

Thank you again!