Assume that 100 file's of type .txt are saved in directory
in which,
40 .txt files having ID 225 in column x
10 .txt files having ID 220 in column x
30 .txt files having ID 115 in column x
and remaining 20 .txt file's having UNIQUE ID say 226,227,228,229,230....
first I want to read only files with UNIQUE ID
like this
for file in *.txt of UNIQUE ID; do
go_function_abc;
done
after this I want to read file's having ID 225
for file in *.txt of ID 225; do
execute_this_function_only_once; (this has to be executed only once I mean when $file==1,not 40 times)
go_to_function_xyz;(this has to be executed 1 to 39 times, that is filecount<no of files)
go_to_last_function(execute this function when filecount==No of files, thats 40==40)
then file's with ID 220,115...
Here for me, no problem in running file's with UNIQUE ID, if many file's are having same ID, then this is the only solution left to me
for file in *.txt; do read <"$file"; Ar=( "$REPLY" ); echo mv "$file" "$file.${Ar[1]}mod"; done
execute_this_function_only_once;
for file in *.225mod; do go_to_function_xyz; mv "$file" "${file%.*}"; done
go_to_last_function
... same for 220, 115, ...
for file in *mod; do go_to_function_abc; mv "$file" "${file%.*}"; done
Sorry, I don't understand your question. You said you have three common IDs, and the rest unique IDs. So what is expected?
Again: for vague requirements/specifications you can expect vague hints/proposals only...
compare $8 1st field with $8 1st field of other file, if not matching, then that filename should be moved to UNIQUE ID array(delete from main array), if suppose matched then ID is duplicate so duplicate ID should be stored in new array, there can be any number of duplicate ID's
after this I want to access Unique ID file's first
some function
once above 1 completes