GradUser2010
Technical User
- Oct 21, 2010
- 6
Hello all,
Thank you in advance for reading this.
I have a group of 190 text files which need to be imported into excel in a predictable manner. They need to be imported alternating between name and values, but sometimes the files do not have any associated values and the next row will go directly to another name.
What I need is a way to search two rows which have two titles back (letter back to back rather than a letter then a number) and insert a placeholder, such as a zero or - in the row between them.
Example of data as is:
L_ax_tri_2.nii.gz
35 420.000000 0.447698 0.088189 0.200144 0.584866
L_cc_tri_2.nii.gz
L_mid_tri_2.nii.gz
20 240.000000 0.488219 0.085022 0.310645 0.609517
L_thal_tri_2.nii.gz
14 168.000000 0.410736 0.099223 0.276966 0.580937
L_wak_tri_2.nii.gz
13 156.000000 0.392963 0.089811 0.208304 0.517843
R_ax_tri_2.nii.gz
R_cc_tri_2.nii.gz
R_mid_tri_2.nii.gz
19 228.000000 0.508231 0.064390 0.420404 0.636616
R_thal_tri_2.nii.gz
29 348.000000 0.449264 0.132066 0.261360 0.699130
R_wak_tri_2.nii.gz
14 168.000000 0.413163 0.096112 0.226829 0.558308
R_ax_tri_2.nii.gz
30 360.000000 0.424469 0.071653 0.283891 0.576231
Example of output data, ideally in a new file, keeping the original file intact.
L_ax_tri_2.nii.gz
35 420.000000 0.447698 0.088189 0.200144 0.584866
L_cc_tri_2.nii.gz
0
L_mid_tri_2.nii.gz
20 240.000000 0.488219 0.085022 0.310645 0.609517
L_thal_tri_2.nii.gz
14 168.000000 0.410736 0.099223 0.276966 0.580937
L_wak_tri_2.nii.gz
13 156.000000 0.392963 0.089811 0.208304 0.517843
R_ax_tri_2.nii.gz
0
R_cc_tri_2.nii.gz
0
R_mid_tri_2.nii.gz
19 228.000000 0.508231 0.064390 0.420404 0.636616
R_thal_tri_2.nii.gz
29 348.000000 0.449264 0.132066 0.261360 0.699130
R_wak_tri_2.nii.gz
14 168.000000 0.413163 0.096112 0.226829 0.558308
R_ax_tri_2.nii.gz
30 360.000000 0.424469 0.071653 0.283891 0.576231
I will be searching through many files in order to manipulate the ones that need editing.
Thanks for any guidance! I am not sure how to begin this processes!
Thank you in advance for reading this.
I have a group of 190 text files which need to be imported into excel in a predictable manner. They need to be imported alternating between name and values, but sometimes the files do not have any associated values and the next row will go directly to another name.
What I need is a way to search two rows which have two titles back (letter back to back rather than a letter then a number) and insert a placeholder, such as a zero or - in the row between them.
Example of data as is:
L_ax_tri_2.nii.gz
35 420.000000 0.447698 0.088189 0.200144 0.584866
L_cc_tri_2.nii.gz
L_mid_tri_2.nii.gz
20 240.000000 0.488219 0.085022 0.310645 0.609517
L_thal_tri_2.nii.gz
14 168.000000 0.410736 0.099223 0.276966 0.580937
L_wak_tri_2.nii.gz
13 156.000000 0.392963 0.089811 0.208304 0.517843
R_ax_tri_2.nii.gz
R_cc_tri_2.nii.gz
R_mid_tri_2.nii.gz
19 228.000000 0.508231 0.064390 0.420404 0.636616
R_thal_tri_2.nii.gz
29 348.000000 0.449264 0.132066 0.261360 0.699130
R_wak_tri_2.nii.gz
14 168.000000 0.413163 0.096112 0.226829 0.558308
R_ax_tri_2.nii.gz
30 360.000000 0.424469 0.071653 0.283891 0.576231
Example of output data, ideally in a new file, keeping the original file intact.
L_ax_tri_2.nii.gz
35 420.000000 0.447698 0.088189 0.200144 0.584866
L_cc_tri_2.nii.gz
0
L_mid_tri_2.nii.gz
20 240.000000 0.488219 0.085022 0.310645 0.609517
L_thal_tri_2.nii.gz
14 168.000000 0.410736 0.099223 0.276966 0.580937
L_wak_tri_2.nii.gz
13 156.000000 0.392963 0.089811 0.208304 0.517843
R_ax_tri_2.nii.gz
0
R_cc_tri_2.nii.gz
0
R_mid_tri_2.nii.gz
19 228.000000 0.508231 0.064390 0.420404 0.636616
R_thal_tri_2.nii.gz
29 348.000000 0.449264 0.132066 0.261360 0.699130
R_wak_tri_2.nii.gz
14 168.000000 0.413163 0.096112 0.226829 0.558308
R_ax_tri_2.nii.gz
30 360.000000 0.424469 0.071653 0.283891 0.576231
I will be searching through many files in order to manipulate the ones that need editing.
Thanks for any guidance! I am not sure how to begin this processes!