I am new to python. I have a file in my $HOME (say a.tcl). I want to extract something from it with a pattern and assign that to a variable. So:
Content of /home/mahmood/a.tcl is:
Expand|Select|Wrap|Line Numbers
- ...
- set ckptdir $::env(SIM)/checkpoints
- ...
I know that in shell, I can do something like this:
Expand|Select|Wrap|Line Numbers
- CKPT_DIR=`grep "^ckptdir" $HOME/a.tcl | sed -e "s/ckptdir"`