Sorry Im new to unix, but just wondering is there anyway I can make the following code into a loop. For example the file name would change every time from 1 to 50
My script is
cut -d ' ' -f5- cd1_abcd_w.txt > cd1_rightformat.txt ;
sed 's! \([^ ]\+\)\( \|$\)!\1 !g' cd1_rightformat.txt ;
sed -i 's/ //g' cd1_rightformat.txt;
cut -d ' ' -f1-4 cd1_abcd_w.txt > cd1_extrainfo.txt ;
I would like to make this into a loop where cd1_abcd_w.txt would then become cd2_abcd_w.txt and output would be cd2_rightformat.txt etc...all the way to 50. So essentially cd$i.
Many thanks