/media/bill/SWAPPER/Qnial/MY_NDFS/strings - grep work 180120.txt string routines www.BillHowell.ca 19Jan2018, initial ********************* 20Jan2018 grep operator, using Unix grep # Don't waste my time! just define a "grep" # xargs -0 --max-args=1 # | xargs -0 grep --invert-match "' grep_expr '" - +-----+ # No workee : host link ' echo "' s_in '" | sed ''s/$/\0/'' | xargs -0 grep -e "' grep_expr '" - | echo >"' p_grep '"' ; host link ' echo "' s_in '" | sed ''s/$/\0/'' | xargs -0 grep "' grep_expr '" - | echo >"' p_grep '"' ; host link ' echo "' s_in '" | sed ''s/$/\0/'' | xargs -0 grep --invert-match "' grep_expr '" - | echo >"' p_grep >> yields errors like : grep: May I live forever in a box. : No such file or directory host link ' echo "' s_in '" | sed ''s/$/\0/'' | echo >>"' p_grep '"' ; host link ' echo "' s_in '"' | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; +-------------------------------------------------------------------------------------------+----------------- |+++++----------------------------++--------------------------------++--------------------++|+++++------------ ||||||+----------------------------++ |May I live forever in a box.|| +----------------------------++ May I live forever in a box.||Who knows what whose nose knows?||Buy a big hamburger.||||||||May I live f |+++++----------------------------++--------------------------------++--------------------++|+++++------------ +-------------------------------------------------------------------------------------------+----------------- --------------------------------------------------------------------------+----------------------------------- ----------------++--------------------------------++--------------------++|+++++----------------------------++ orever in a box.||Who knows what whose nose knows?||Buy a big hamburger.||||||||May I live forever in a box.|| ----------------++--------------------------------++--------------------++|+++++----------------------------++ --------------------------------------------------------------------------+----------------------------------- --------------------------------------------------------+ --------------------------------++--------------------++| Who knows what whose nose knows?||Buy a big hamburger.||| --------------------------------++--------------------++| --------------------------------------------------------+ >> Nuts, I had changed "grep IS OP s_in grep_expr" to "grep IS OP grep_expr s_in", but didn't change data! 20Jan2018 [write, host] link ' echo "' s_in '"' | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; grep ('May I live forever in a box.' 'Who knows what whose nose knows?' 'Buy a big hamburger.') 'ow' >> This doesn't work as an array of strings is provided 'ow' EACHRIGHT grep ('May I live forever in a box.' 'Who knows what whose nose knows?' 'Buy a big hamburger.') +-------------------------------+-----------------------------------------------------------------+----------- |+----------------------------++|+----------------------------++--------------------------------++|+---------- ||May I live forever in a box.||||May I live forever in a box.||Who knows what whose nose knows?||||May I live |+----------------------------++|+----------------------------++--------------------------------++|+---------- +-------------------------------+-----------------------------------------------------------------+----------- D_D_QNIAL_MINE ----------------------------------------------------------------------------+ ------------------++--------------------------------++--------------------++| forever in a box.||Who knows what whose nose knows?||Buy a big hamburger.||| ------------------++--------------------------------++--------------------++| ----------------------------------------------------------------------------+ >> Do just ONE to see what I get grep 'ow' 'May I live forever in a box.' >> Must delete temp file BEFORE running rest of code... +----------------------------++ |May I live forever in a box.|| +----------------------------++ >> OK 'ow' EACHRIGHT grep ('May I live forever in a box.' 'Who knows what whose nose knows?' 'Buy a big hamburger.') +-------------------------------+-------------------------------- IF = f_in (fault '?No such file or directory') THEN %write link ' echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; host link ' echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; ELSE host link '<"' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; ENDIF ; ---+-----------------------+ |+----------------------------++|+--------------------------------++|+--------------------++| ||May I live forever in a box.||||Who knows what whose nose knows?||||Buy a big hamburger.||| |+----------------------------++|+--------------------------------++|+--------------------++| +-------------------------------+-----------------------------------+-----------------------+ >> Much better having removed the temp file with each grep >> now to get rid of trailing empty line. change last line from "s_out" to "front s_out" 'ow' EACHRIGHT grep ('May I live forever in a box.' 'Who knows what whose nose knows?' 'Buy a big hamburger.') +------------------------------+---------------(renamed-------------------+----------------------+ |+----------------------------+|+--------------------------------+|+--------------------+| ||May I live forever in a box.|||Who knows what whose nose knows?|||Buy a big hamburger.|| |+----------------------------+|+--------------------------------+|+--------------------+| +------------------------------+----------------------------------+----------------------+ >> Better Change s_out := link s_out (solitary readed) ; To s_out := link s_out readed ; 'ow' EACHRIGHT grep ('May I live forever in a box.' 'Who knows what whose nose knows?' 'Buy a big hamburger.') +---------------------------+-------------------------------+-------------------+ |May I live forever in a box|Who knows what whose nose knows|Buy a big hamburger| +---------------------------+-------------------------------+-------------------+ >> Awesome!!! >> Current version, for a single string, is : grep IS OP grep_expr s_in { p_grep := link d_QNial_temp 'grep_temp.txt' ; host link 'rm "' p_grep '"' ; [write, host] link ' echo "' s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; fin := open p_grep "r ; s_out := null ; WHILE (??eof <> (readed := readfile fin)) DO s_out := link s_out readed ; ENDWHILE ; close fin ; %write link "s_out= " s_out ; front s_out } >> Note that I'm still NOT doing the grep!! I'm just checking the string processing at a simple level. +-----+ 20Jan2018 Take out "write"s, expand to file : grep IS OP grep_expr f_or_s_in { p_grep := link d_QNial_temp 'grep_temp.txt' ; host link 'rm "' p_grep '"' ; f_in := open f_or_s_in "r ; % ; IF = f_in (fault '?No such file or directory') IF = f_in (fault '?No such file or directory') THEN %write link ' echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; host link ' echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; ELSE host link '<"' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; ENDIF ; THEN %write link ' echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; host link ' echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; ELSE host link '<"' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; ENDIF ; close f_in ; % ; fin := open p_grep "r ; s_out := null ; WHILE (??eof <> (readed := readfile fin)) DO s_out := link s_out readed ; ENDWHILE ; close fin ; % ; %write link "s_out= " s_out ; front s_out } Test : qnial> grep 'd_QNial_' '/media/bill/HOWELL_BASE/Qnial/setup.ndf' /media/bill/HOWELL_BASE/Qnial/setup.nd >> oops, Change back : front s_out To : s_out bill@bill_lenovo:~$ <"/media/bill/HOWELL_BASE/Qnial/setup.ndf" bash: /media/bill/HOWELL_BASE/Qnial/setup.ndf: No such file or directory >> oops qnial> <"/media/bill/SWAPPER/Qnial/setup.ndf" ?< expects a pair qnial> host 'echo <"/media/bill/SWAPPER/Qnial/setup.ndf"' nothing... not supposed to use cat!! qnial> host 'cat <"/media/bill/SWAPPER/Qnial/setup.ndf"' >> OK, lists file contents Change : IF = f_in (fault '?No such file or directory') qnial> grep '"d_QNial_"' '"/media/bill/SWAPPER/Qnial/setup.ndf"' THEN %write link ' echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; host link ' echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; ELSE host link '<"' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; ENDIF ; To : IF = f_in (fault '?No such file or directory') THEN %write link ' echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; host link ' echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; ELSE host link 'cat "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; ENDIF ; qnial> grep 'd_QNial_' '/media/bill/SWAPPER/Qnial/setup.ndf' >> WRONG! this merges the lines >> take out "| sed ''s/$/\0/''" grep 'd_QNial_' '/media/bill/SWAPPER/Qnial/setup.ndf' qnial> grep 'd_QNial_' '/media/bill/SWAPPER/Qnial/setup.ndf' xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option # /media/bill/HOWELL_BASE/Qnial/setup.ndf # Define setup, important startup loads # Important - >> take out "-0" for file part IF = f_in (fault '?No such file or directory') THEN %write link ' echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; host link ' echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; ELSE host link 'cat "' f_or_s_in '" | xargs echo >>"' p_grep '"' ; ENDIF ; . qnial> grep '"d_QNial_"' '"/media/bill/SWAPPER/Qnial/setup.ndf"' /media/bill/SWAPPER/Qnial/setup.ndf >> Retry, after manually closing /media/bill/SWAPPER/Qnial/setup.ndf >> same thing. I think that the file open is failing?? IF = f_in (fault '?No such file or directory') THEN [write, host] link 'echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; ELSE [write, host] link 'cat "' f_or_s_in '" | xargs echo >>"' p_grep '"' ; ENDIF ; qnial> grep '"d_QNial_"' '"/media/bill/SWAPPER/Qnial/setup.ndf"' echo ""/media/bill/SWAPPER/Qnial/setup.ndf"" | sed 's/$/\0/' | xargs -0 echo >>"/media/bill/ramdisk/grep _temp.txt" /media/bill/SWAPPER/Qnial/setup.ndf >> oops, double quotations qnial> grep 'd_QNial_' '/media/bill/SWAPPER/Qnial/setup.ndf' cat "/media/bill/SWAPPER/Qnial/setup.ndf" | xargs echo >>"/media/bill/ramdisk/grep _temp.txt" xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option # /media/bill/HOWELL_BASE/Qnial/setup.ndf # Define setup, important startup loads # Important - >> But there AREN'T any single quotes! So I must put in xargs -0, but after tr \\0 \\n >> AND why does temp file look OK, but QNial result merges all lines? >> Revised, to convert nulls : IF = fin (fault '?No such file or directory') THEN [write, host] link 'echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep '"' ; ELSE [write, host] link 'cat "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 echo >>"' p_grep2 '"' ; [write, host] link 'echo "' p_grep2 '" | tr \\0 \\n | xargs -0 echo >>"' p_grep '"' ; ENDIF ; . qnial> grep 'd_QNial_' '/media/bill/SWAPPER/Qnial/setup.ndf' >> same problem >> Try changing link to append : WHILE (??eof <> (readed := readfile fin)) DO s_out := append s_out readed ; ENDWHILE ; >> OK, now it works!! +-----+ 20Jan2018 Now convert to an actual grep - start with string inputs grep IS OP grep_expr f_or_s_in { p_grep := link d_QNial_temp 'grep_temp.txt' ; host link 'rm "' p_grep '"' ; % ; fin := open f_or_s_in "r ; IF = fin (fault '?No such file or directory') THEN [write, host] link 'echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 grep >>"' p_grep '"' ; ELSE [write, host] link 'cat "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 grep >>"' p_grep '"' ; ENDIF ; close fin ; % ; fin := open p_grep "r ; s_out := null ; WHILE (??eof <> (readed := readfile fin)) DO s_out := append s_out readed ; ENDWHILE ; close fin ; % ; %write link "s_out= " s_out ; s_out } >> Test string first qnial> 'ow' EACHRIGHT grep ('May I live forever in a box.' 'Who knows what whose nose knows?' 'Buy a big hamburger.') echo "May I live forever in a box." | sed 's/$/\0/' | xargs -0 grep >>"/media/bill/ramdisk/grep_temp.txt " echo "Who knows what whose nose knows?" | sed 's/$/\0/' | xargs -0 grep >>"/media/bill/ramdisk/grep_temp .txt" echo "Buy a big hamburger." | sed 's/$/\0/' | xargs -0 grep >>"/media/bill/ramdisk/grep_temp.txt" ++++ |||| ++++ >> Not so good, nothing in temp file >> Iterate : IF = fin (fault '?No such file or directory') THEN [write, host] link 'echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 -I stringer bash -c '' grep "' grep_expr '" stringer >>"' p_grep '" '' ' ; ELSE [write, host] link 'cat "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 grep >>"' p_grep '"' ; ENDIF ; >> Each word is treated individually, so sed 's/$/\0/' isn't working? IF = fin (fault '?No such file or directory') THEN [write, host] link 'echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 grep "' grep_expr '" stringer >>"' p_grep '" ' ; ELSE [write, host] link 'cat "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 grep >>"' p_grep '"' ; ENDIF ; >> Each word is treated individually, so sed 's/$/\0/' isn't working? THEN [write, host] link 'echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 grep "' grep_expr '" >>"' p_grep '" ' ; qnial> 'ow' EACHRIGHT grep ('May I live forever in a box.' 'Who knows what whose nose knows?' 'Buy a big hamburger.') echo "May I live forever in a box." | sed 's/$/\0/' | xargs -0 grep "ow" >>"/media/bill/ramdisk/grep_te mp.txt" grep: May I live forever in a box. : No such file or directory echo "Who knows what whose nose knows?" | sed 's/$/\0/' | xargs -0 grep "ow" >>"/media/bill/ramdisk/gre p_temp.txt" grep: Who knows what whose nose knows? : No such file or directory echo "Buy a big hamburger." | sed 's/$/\0/' | xargs -0 grep "ow" >>"/media/bill/ramdisk/grep_temp.txt" grep: Buy a big hamburger. : No such file or directory ++++ |||| ++++ >> Try to force grep to recognize stdin as string, not a filename : >> man grep - use -F option!!! THEN [write, host] link 'echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 grep -F "' grep_expr '" >>"' p_grep '" ' ; >> NYET - -F is for the pattern >> try again "-" to use stdin rather than a file THEN [write, host] link 'echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 grep - "' grep_expr '" >>"' p_grep '" ' ; qnial> 'ow' EACHRIGHT grep ('May I live forever in a box.' 'Who knows what whose nose knows?' 'Buy a big hamburger.') echo "May I live forever in a box." | sed 's/$/\0/' | xargs -0 grep - "ow" >>"/media/bill/ramdisk/grep _temp.txt" grep: ow: No such file or directory grep: May I live forever in a box. : No such file or directory echo "Who knows what whose nose knows?" | sed 's/$/\0/' | xargs -0 grep - "ow" >>"/media/bill/ramdisk/ grep_temp.txt" grep: ow: No such file or directory grep: Who knows what whose nose knows? : No such file or directory echo "Buy a big hamburger." | sed 's/$/\0/' | xargs -0 grep - "ow" >>"/media/bill/ramdisk/grep_temp.tx t" grep: ow: No such file or directory grep: Buy a big hamburger. : No such file or directory ++++ |||| ++++ >> Put "-" after pattern! THEN [write, host] link 'echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 grep "' grep_expr '" - >>"' p_grep '" ' ; qnial> 'ow' EACHRIGHT grep ('May I live forever in a box.' 'Who knows what whose nose knows?' 'Buy a big hamburger.') echo "May I live forever in a box." | sed 's/$/\0/' | xargs -0 grep "ow" - >>"/media/bill/ramdisk/gre p_temp.txt" grep: May I live forever in a box. : No such file or directory echo "Who knows what whose nose knows?" | sed 's/$/\0/' | xargs -0 grep "ow" - >>"/media/bill/ramdisk /grep_temp.txt" grep: Who knows what whose nose knows? : No such file or directory echo "Buy a big hamburger." | sed 's/$/\0/' | xargs -0 grep "ow" - >>"/media/bill/ramdisk/grep_temp.t xt" grep: Buy a big hamburger. : No such file or directory ++++ |||| ++++ >> better but no cigar >> Try THEN [write, host] link 'echo "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 grep -e "' grep_expr '" >>"' p_grep '" ' ; >> same problem >> Try THEN [write, host] link 'echo "' f_or_s_in '" | sed ''s/$/\0/'' | tr \\0 \\n | grep -e "' grep_expr '" >>"' p_grep '" ' ; qnial> 'ow' EACHRIGHT grep ('May I live forever in a box.' 'Who knows what whose nose knows?' 'Buy a big hamburger.') echo "May I live forever in a box." | sed 's/$/\0/' | tr \\0 \\n | grep -e "ow" >>"/media/bill/ramd isk/grep_temp.txt" echo "Who knows what whose nose knows?" | sed 's/$/\0/' | tr \\0 \\n | grep -e "ow" >>"/media/bill/ ramdisk/grep_temp.txt" echo "Buy a big hamburger." | sed 's/$/\0/' | tr \\0 \\n | grep -e "ow" >>"/media/bill/ramdisk/grep _temp.txt" ++----------------------------------++ ||+--------------------------------+|| |||Who knows what whose nose knows?||| ||+--------------------------------+|| ++----------------------------------++ >> OK, this is the right answer for each qnial> grep 'ow' 'Who knows what whose nose knows?' echo "Who knows what whose nose knows?" | sed 's/$/\0/' | tr \\0 \\n | grep -e "ow" >>"/media/bill/ ramdisk/grep_temp.txt" +--------------------------------+ |Who knows what whose nose knows?| +--------------------------------+ >> the string shouldn't be a solitary? Maybe it's best is is? <- NYET >> the temp file is fine, I have to fix the read Change final output : s_out To : IF (= 1 (gage shape s_out)) THEN s_out := first s_out ; ENDIF ; s_out qnial> grep 'ow' 'Who knows what whose nose knows?' echo "Who knows what whose nose knows?" | sed 's/$/\0/' | tr \\0 \\n | grep -e "ow" >>"/media/bill/ ramdisk/grep_temp.txt" Who knows what whose nose knows? >> perfect!! >> Test multiple strings : qnial> 'ow' EACHRIGHT grep ('May I live forever in a box.' 'Who knows what whose nose knows?' 'Buy a big hamburger.') echo "May I live forever in a box." | sed 's/$/\0/' | tr \\0 \\n | grep -e "ow" >>"/media/bill/ramd isk/grep_temp.txt" echo "Who knows what whose nose knows?" | sed 's/$/\0/' | tr \\0 \\n | grep -e "ow" >>"/media/bill/ ramdisk/grep_temp.txt" echo "Buy a big hamburger." | sed 's/$/\0/' | tr \\0 \\n | grep -e "ow" >>"/media/bill/ramdisk/grep _temp.txt" ++--------------------------------++ ||Who knows what whose nose knows?|| ++--------------------------------++ >> get rid of null components : WHILE (??eof <> (readed := readfile fin)) DO IF <> null s_out THEN s_out := append s_out readed ; ENDIF ; ENDWHILE ; close fin ; % ; IF (= 1 (gage shape s_out)) THEN s_out := first s_out ; ENDIF ; s_out qnial> grep 'zz' 'Who knows what whose nose knows?' echo "Who knows what whose nose knows?" | sed 's/$/\0/' | tr \\0 \\n | grep -e "zz" >>"/media/bill/ ramdisk/grep_temp.txt" >> OK. Note the empty line (null) qnial> 'ow' EACHRIGHT grep ('May I live forever in a box.' 'Who knows what whose nose knows?' 'Buy a big hamburger.') echo "May I live forever in a box." | sed 's/$/\0/' | tr \\0 \\n | grep -e "ow" >>"/media/bill/ramd isk/grep_temp.txt" echo "Who knows what whose nose knows?" | sed 's/$/\0/' | tr \\0 \\n | grep -e "ow" >>"/media/bill/ ramdisk/grep_temp.txt" echo "Buy a big hamburger." | sed 's/$/\0/' | tr \\0 \\n | grep -e "ow" >>"/media/bill/ramdisk/grep _temp.txt" ++++ |||| ++++ >> OUCH! I've lost the output because of IF <> null s_out THEN s_out := append s_out readed ; ENDIF ; >> Change : WHILE (??eof <> (readed := readfile fin)) DO IF <> null s_out THEN s_out := append s_out readed ; ENDIF ; ENDWHILE ; close fin ; % ; IF (= 1 (gage shape s_out)) THEN s_out := first s_out ; ENDIF ; s_out >> To : WHILE (??eof <> (readed := readfile fin)) DO s_out := append s_out readed ; ENDWHILE ; close fin ; % ; s_out := (null EACHRIGHT <> s_out) sublist s_out >> Must use "unequal" instead of "<>" - I don;'t know why, as "=" seems to work the same as "equal"? s_out := (null EACHRIGHT unequal s_out) sublist s_out qnial> grep 'ow' 'Who knows what whose nose knows?' echo "Who knows what whose nose knows?" | sed 's/$/\0/' | tr \\0 \\n | grep -e "ow" >>"/media/bill/ ramdisk/grep_temp.txt" +--------------------------------+ |Who knows what whose nose knows?| +--------------------------------+ >> NUTS! bach to earlier problem. May need : IF (= 1 (gage shape s_out)) THEN s_out := first s_out ; ENDIF ; s_out qnial> 'ow' EACHRIGHT grep ('May I live forever in a box.' 'Who knows what whose nose knows?' 'Buy a big hamburger.') echo "May I live forever in a box." | sed 's/$/\0/' | tr \\0 \\n | grep -e "ow" >>"/media/bill/ramd isk/grep_temp.txt" echo "Who knows what whose nose knows?" | sed 's/$/\0/' | tr \\0 \\n | grep -e "ow" >>"/media/bill/ ramdisk/grep_temp.txt" echo "Buy a big hamburger." | sed 's/$/\0/' | tr \\0 \\n | grep -e "ow" >>"/media/bill/ramdisk/grep _temp.txt" ++----------------------------------++ ||+--------------------------------+|| |||Who knows what whose nose knows?||| ||+--------------------------------+|| ++----------------------------------++ >> Change to : WHILE (??eof <> (readed := readfile fin)) DO s_out := append s_out readed ; ENDWHILE ; close fin ; % ; s_out := (null EACHRIGHT unequal s_out) sublist s_out ; IF (= 1 (gage shape s_out)) THEN s_out := first s_out ; ENDIF ; s_out . qnial> grep 'ow' 'Who knows what whose nose knows?' echo "Who knows what whose nose knows?" | sed 's/$/\0/' | tr \\0 \\n | grep -e "ow" >>"/media/bill/ ramdisk/grep_temp.txt" Who knows what whose nose knows? >> perfect qnial> 'ow' EACHRIGHT grep ('May I live forever in a box.' 'Who knows what whose nose knows?' 'Buy a big hamburger.') echo "May I live forever in a box." | sed 's/$/\0/' | tr \\0 \\n | grep -e "ow" >>"/media/bill/ramd isk/grep_temp.txt" echo "Who knows what whose nose knows?" | sed 's/$/\0/' | tr \\0 \\n | grep -e "ow" >>"/media/bill/ ramdisk/grep_temp.txt" echo "Buy a big hamburger." | sed 's/$/\0/' | tr \\0 \\n | grep -e "ow" >>"/media/bill/ramdisk/grep _temp.txt" ++--------------------------------++ ||Who knows what whose nose knows?|| ++--------------------------------++ >> perfect, as results for three separate queries are returned +-----+ 20Jan2018 Now convert to an actual grep - this time with file input >> Change : ELSE [write, host] link 'cat "' f_or_s_in '" | sed ''s/$/\0/'' | xargs -0 grep >>"' p_grep '"' ; >> To : ELSE [write, host] link 'cat "' f_or_s_in '" | sed ''s/$/\0/'' | tr \\0 \\n | grep -e "' grep_expr '" >>"' p_grep '" ' ; qnial> grep 'd_QNial_' '/media/bill/SWAPPER/Qnial/setup.ndf' cat "/media/bill/SWAPPER/Qnial/setup.ndf" | sed 's/$/\0/' | tr \\0 \\n | grep -e "d_QNial_" >>"/me dia/bill/ramdisk/grep_temp.txt" +-------------------------------------------------+------------------------------------------------+---------- |d_QNial_root := '/media/bill/SWAPPER/Qnial/' ; |d_QNial_lib := link d_QNial_root 'niallib/' ; |d_Qnial_Mi +-------------------------------------------------+------------------------------------------------+---------- ---------------------------------------------+------------------------------------------------+--------------- das := link d_QNial_root 'Midas_backup/' ; |d_QNial_mine := link d_QNial_root 'MY_NDFS/' ; |d_QNial_Stats : ---------------------------------------------+------------------------------------------------+--------------- -------------------------------------------------------------+-------------------------------------------+---- = link d_QNial_root 'Smillie UAlberta - statistics 1987/' ; |d_QNial_temp := '/media/bill/ramdisk/' ; |d_Qn -------------------------------------------------------------+-------------------------------------------+---- ------------------------------------------------+----------------------------+-------------------------------- ial_USB := link d_QNial_root 'USB_backup/' ; | NONLOCAL d_QNial_temp ; | p_debug := link d_QNial_tem ------------------------------------------------+----------------------------+-------------------------------- -------------------------------+----------------------------+------------------------------------------------- p '0_QNial debug log.txt' ; | NONLOCAL d_QNial_temp ; | p_debug := link d_QNial_temp '0_QNial debug -------------------------------+----------------------------+------------------------------------------------- --------------+----------------------------+------------------------------------------------------+----------- log.txt' ; | NONLOCAL d_QNial_temp ; | p_log := link d_QNial_temp '0_QNial log.txt' ; | NONLOCAL --------------+----------------------------+------------------------------------------------------+----------- -----------------+------------------------------------------------------+----------------------------+-------- d_QNial_temp ; | p_log := link d_QNial_temp '0_QNial log.txt' ; | NONLOCAL d_QNial_temp ; | pname_s -----------------+------------------------------------------------------+----------------------------+-------- --------------------------------------------------------------+----------------------------------------------- cript := link d_QNial_temp '0_QNial shellApp_cmds.txt' ; | loaddefs (link d_QNial_mine 'strings.ndf') --------------------------------------------------------------+----------------------------------------------- ----+----------------------------------------------------------------------------------------------+---------- 0 ; |lq_matrix IS loaddefs link d_QNial_mine 'matrix operations - symbolic & real-valued.ndf' |lq_matrixR ----+----------------------------------------------------------------------------------------------+---------- ---------------------------------------------------------------------+---------------------------------------- edn IS loaddefs link d_QNial_mine 'matrix - symbolic reduction.ndf' |lq_align_paren IS loaddefs link d_QNial_ ---------------------------------------------------------------------+---------------------------------------- ----------------------------------------------------+--------------------------------------------------------- mine 'matrix - write with parenthesis aligned.ndf' |lq_matrix_examples IS loaddefs link d_QNial_mine 'matri ----------------------------------------------------+--------------------------------------------------------- -------------------------------------------+------------------------------------------------------------------ x_multiply - examples and validation.ndf' |lq_directed_graphs IS loaddefs link d_QNial_mine 'directed graph -------------------------------------------+------------------------------------------------------------------ -----------+----------------------------------------------------------------+--------------------------------- s.ndf' ; | fpath_log := link d_QNial_root 'z_HDdrive_mountCheck.txt' ; | loaddefs (link d_QNial_mine 'f -----------+----------------------------------------------------------------+--------------------------------- ------------------+------------------------------------------------------------------------------------------- ile_ops.ndf') 0 ; |lq_windows IS loaddefs link d_QNial_mine 'windows - position, size, move, desktop opens. ------------------+------------------------------------------------------------------------------------------- -------+-----------------------------------------------------------------------------+------------------------ ndf' |lq_audios IS loaddefs link d_QNial_mine 'audio - music, microphone.ndf' |lq_quips IS loaddefs (l -------+-----------------------------------------------------------------------------+------------------------ -------------------------------+----------------------------------------------------------+ ink d_QNial_root 'quips.ndf') |lq_workSpace IS loaddefs link d_QNial_mine f_workSpace | -------------------------------+----------------------------------------------------------+ >> Awesome! # enddoc