list - Pick out certain lines from files -


i writing tcl script reads file , displays lines file. can read file n problem cant figure out how pick out lines before filtering out don't need. reading file list , using following code filter out;

proc listfromfile {/.../.../.../file_test.file} { set f [open /.../.../.../file_test.file r] set data [split [string trim [read $f]]] close $f return $data } set f [listfromfile /.../.../.../file_test.file] set f [lsort -unique $f] set f [lsearch -all -inline $f "test_*" 

the lines within file like

$(eval $(call createuvmtest, other, test_runtest1 ... $(eval $(call createuvmtest, keyword, test_runtest2 ... $(eval $(call createuvmtest, keyword, test_runtest3 ... $(eval $(call createuvmtest, other, test_runtest4 ... 

how pick out lines containing keyword whole before filter out else don't need? lines containing keyword randomly within file along other tests. possibility @ all?

it shouldn't hard. begin with, want split file's contents @ line breaks:

set data [split [string trim [read $f]] \n] 

when you've done that, use number of techniques select lines want, instance

lsearch -all -inline $data *keyword* 

documentation: lsearch, read, set, split, string


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -