echo Name > create_Name.txt
echo Group /dir/group, Name >> create_Name.txt
File 2:
Name AAA BBB CCC
group A B C
dir A1 B1 C1
................................
Need to replace the contents of File 1 with column 2, 3 & 4 values of File 2 where ever column 1 of File 2 matches with the words in File 1. The number of output files would be number of columns in File 2 minus 1. In this case it would be 3.
ie., Contents of Output File1 (cre_AAA.sh) would be:
echo AAA > create_AAA.txt
echo Group /A1/A, AAA >> create_AAA.txt
Contents of Output File2 (cre_BBB.sh) would be:
echo BBB > create_BBB.txt
echo Group /B1/B, BBB >> create_BBB.txt
Contents of Output File3 (cre_CCC.sh) would be:
echo CCC > create_CCC.txt
echo Group /C1/C, CCC >> create_CCC.txt
and so on ...
File 1 is static but File 2 would be dynamic. There could be many columns (AAA, BBB,...FFF) and parameters (Name, dir, group, ... location) in it.
Thanks, Scrutinizer. But I am getting this error when running it:
awk: syntax error near line 6
awk: illegal statement near line 6
awk: syntax error near line 14
awk: illegal statement near line 14
awk: syntax error near line 15
awk: illegal statement near line 15