Open main menu

Changes

Grep log file

709 bytes added, 17:47, 22 October 2015
Added an intro sentence.
The following describes how to convert a relax log file into a relax script.
 
== Grep the log file for commands ==
First we find which commands relax has performed, and separate into the different fitting models.<br>
We also just make some line space and important points. Then we replace instances of '''relax> ''' with empty, and comment out the model line. Put this into a file: '''relax_log_to_py.sh''' <source lang="bash">#!/bin/tcsh ;-f set LOGS=`ls -v -d -1 *.log`foreach LOG ( ${LOGS} ) set INBNAME=LOGFILE`basename $LOG .txtlog` set OUT=greplogfile"grep_${BNAME}.txtpy" egrep -wi --color 'relax>| model -' LOGFILE.txt $LOG > $OUT;Then we replace instances of '''relax> ''' with empty, and comment out the model line sed -i "s/relax> //"$OUT ; sed -i 's/^- /\n#- /' $OUT ; sed -i 's/^minimise(/\nminimise(/' test $OUT ;sed -i 's/^script(/\n#script(/' $OUT ;sed -i 's/^results.write(/\nresults.write(/' $OUT ;sed -i 's/^model_selection(/\nmodel_selection(/' $OUT ; sed -i '0,/spectrum.replicated(/s//\nspectrum.replicated(/' test $OUT ;sed -i '0,/spectrum.read_intensities(/s//\nspectrum.read_intensities(/' $OUT ;end</source> Make it executable<source lang="bash">chmod +x relax_log_to_py.sh</source> End then execute it<source lang="bash">./relax_log_to_py.sh# ORtcsh relax_log_to_py.sh</source> Then look out for files starting with '''grep_'''.
== See also ==
[[Category:grep]]
[[Category:Results]]
Trusted, Bureaucrats
4,223

edits