Hello Esteemed Members,
I need to write a script to search for files that have one or more than one rows similar.
Please note that there is no specific pattern that I am searching for. The rows can be different, I just need to find out two or more similar records in two or more files.
There are around 5000 such files that I need to search amongst.
The files are scattered in same directory but different sub-directories.
$/abc/xyz/ap/.prm
$/abc/xyz/dd/.prm
$/abc/xyz/rt/*.prm
that is, the path until xyz is same and I need to check all the prm files in sub-folders under ap, dd, rt and so on.
My basic criteria is to check for all the prm files which have exactly the same rows.
Like in the example below, two different prm files are under diffenret sub-directories but they both contain a similar row
none >> host_buf.tpl >> $CCWSCA_sbcdl/shr/dl_fnaccv_host_buf.raw
prompt>~/sbc_generated/v760 [49]> grep dl_fnaccv_host_buf */*.prm
cdw/fn_account_ca_view.prm:none >> host_buf.tpl >> $CCWSCA_sbcdl/shr/dl_fnaccv_host_buf.raw
fn/fn_account_audit_view.prm:none >> host_buf.tpl >> $CCWSCA_sbcdl/shr/dl_fnaccv_host_buf.raw
How do I find all such files?
I tried searching for answers to this kind of script and created the following
filecnt=$( find /sbc_generated/v77_0/*/*.prm -type f )
awk -v 5000=$filecnt '
{arr[$0]++; next}
END{for (i in arr) {
if(arr==n) {
print arr
}
} ' $( find /sbc_generated/v77_0/*/*.prm -type f) > common_rec
but it is giving me the following error
exec(2): Could not load a.out due to swap reservation failure
or due to insufficient user stack size
Please help me rectify the above error and create a running script in k shell (ksh).
Thank you!