I am doing a research project that requires shell scripting, which I have almost no experience in, although I do have some programming experience. Here is the file in question:
export OMP_NUM_THREADS=12 read controls #inlist directory export MESA_INLIST="/home/nick/mesa-r11701/star/test_suite/rsp_Cepheid_grid/inlist" sed -i -e 's/.*extra_star_job_inlist2_name.*/extra_star_job_inlist2_name = '"'"''$controls"""'"'/i' $MESA_INLIST sed -i -e 's/.*extra_controls_inlist2_name.*/extra_controls_inlist2_name = '"'"''$controls"""'"'/i' $MESA_INLIST I am borrowing this file to change the input of this second file /home/nick/mesa-r11701/star/test_suite/rsp_Cepheid_grid/inlist. Specifically the extra_controls_inlist2_name and the extra_star_job_inlist2_name variables (what is after the right side of the equal sign).
! this is the master inlist that MESA reads when it starts. ! This file tells MESA to go look elsewhere for its configuration ! info. This makes changing between different inlists easier, by ! allowing you to easily change the name of the file that gets read. &star_job read_extra_star_job_inlist1 = .true. extra_star_job_inlist1_name = 'inlist_0all' read_extra_star_job_inlist2 = .true. extra_star_job_inlist2_name = 'inlist_3ms' / ! end of star_job namelist &controls read_extra_controls_inlist1 = .true. extra_controls_inlist1_name = 'inlist_0all' read_extra_controls_inlist2 = .true. extra_controls_inlist2_name = 'inlist_3ms' / ! end of controls namelist &pgstar / ! end of pgstar namelist I am already familiar with what the export and read commands do. I know that sed is a stream editor that is used for finding and replacing text, which is what my goal with the second file is here. However, what do the -i -e options do here exactly? Why are there so many quotes around $controls$? What do the /.* and the /i of the sed command mean? I tried to do a preliminary search for these online, but I could not find an appropriate answer.
man sed?info sedin this case, as e.g./iis not explained properly in the GNUsedmanual, for whatever reason.