I want to write a scrpit to merge files row wise (actually concatinating)
main.txt
X Y Z
file 1
A B C
file 2
1 2 3
now i want the script to check if the file1 is empty or not, if empty then make it like
A B C
1 2 3
again to check if second file is empty if not do as done previously or else append the third file.
everytime it has to update the main.txt file (i.e tht will be my output file)
I have used some code but it dosent work
R_path="${HOME}/Desktop/at/examples_own/RESULTS"
B_path="${HOME}/Desktop/at/examples_own/BATHYMETRY"
dummyprofile=seaprofile1
outputdummyfile=profile1.txt
dummyfile=seamount1
awk BEGIN { while ((getline first < ""${R_path}/output_delay.txt"") > 0 \
&& (getline second < ""${R_path}/$outputdummyfile"") > 0)
{ print first
print second }
while ((getline first < ""${R_path}/output_delay.txt"") > 0)
{ print first}
while ((getline second < ""${R_path}/$outputdummyfile"") > 0)
{ print second }
} output_delay.txt