#] #] ********************* #] "$d_Qroot"'1_QNial-customized [unix, txtEd, etc] tools.txt' - #] [[find, grep, etc] summary, awareness thing] for QNial projects # www.BillHowell.ca 03Nov2021 initial from "$d_Qtest"'fileops/Qndfs optr symbol changes - develop.txt' # view this file in a text editor, with [constant width font, tab = 3 spaces], no line-wrap # 05Nov2021 - gutted, problems with inconsistent redundancies 08********08 #] +-----+ #] Search [ndf, txt] files in d_Q[root, ndfs, test] for [strings, [optr,var] symbols, etc] : #] $ find "$d_Qroot" -type f \( -name "*.ndf" -o -name "*.txt" \) | grep --invert-match "z_Old" | grep --invert-match "z_Archive" | sort | tr \\n \\0 | xargs -0 -IFILE grep --with-filename --line-number 'ary_indexA_convertTo_boolA' "FILE" | sed "s|$d_Qroot||;s|:.*||" | sort -u >"$d_temp"'find-grep-sed temp.txt' #] list Howells [bash scripts, QNial operators] - essential map for finding shit, twig the bash cmd line #] see "$d_bin""0_list Howells [bash scripts, QNial operators].sh" # find "$d_Qndfs" -name "*.ndf" | grep --invert-match "z_Old" | grep --invert-match "z_Archive" | sort | tr \\n \\0 | xargs -0 -IFILE grep "#\] " "FILE" | sed "s/#] /\t/" >>"$d_Qndfs"'0_list of Howells QNial programs.txt' #] +--+ #] grep words (symbols) -w = word, -i = case insensitive $ find "$d_Qndfs" -type f -name "*.ndf" | grep --invert-match 'z_Archive' | grep --invert-match 'z_Old' | tr \\n \\0 | xargs -0 -ILINE grep -w -i --with-filename --line-number "str_to_phrases1" LINE #] Mindcode - search temp file # $ find "$d_Qndfs""MindCode" -type f -name "*.ndf" | tr \\n \\0 | xargs -0 -ILINE grep --with-filename "^#]" LINE | grep --invert-match 'z_Archive' "$d_temp""5_MindCode globals temp.txt" | grep --invert-match 'z_Old' | sed 's/.*#]//' #] +-----+ #] write to file : WARNING!!! don't use writefile, use : #] strL_write_pout_pthTyp IS OP strL pthTyp pout - write strL to pout, pthTyp = ["p_old "p_new "p_ovr] #] +-----+ #] Quick display of "Tables of Contents" for key ndf files : # see 'QNial setup - header.ndf' #] operator declaration paragraph : common statements (eg, [[, should] uses] cart [sed, grep]) # uses sed, therefore may not simply handle sed restricted : search $.*/[\]^ replace &\/\n # uses grep therefore may not simply handle grep restricted : search $.*/[\]^ # should simply use [find, grep, sed]? but cannot simply handle chrs : search $.*/[\]^ replace &\/\n #] [track, protect] ongoing symbol changes! protect sequence name replacement with [_z, z_], eg : #! 06Sep2021 : file_exists_z IS z_path_exists #! 09Oct2021 [same, changed] arg[order,num]: str_splitByChrsNotAllowedTo_words_z IS OP z_str_cutBy_chrInclL #] 21Oct2021 remove problematic extra spaces in ALL ndfs - will affect symbol [search, replace] : #] geany regexpr search '[ ]*IS OP[ ]*' replace ' IS OP ' #] geany regexpr search case-sensitive '[ ]*IS [ ]+' replace ' IS ' #] geany escape search case-sensitive ' IS \n' replace ' IS \n' #] QNial -> only AFTER [fix, test] of pthL_strL_grepOptions_linesTo_pout did geany for [QNial setup, strings, file_ops], but not yet [boolean, [array, tables], lists] #] QNial_user_symbol_changes_backup IS - pth_backupDatedTo_zArchive of "core" ndfs for a project # see : 'QNial usrWkSpc symbol changes.ndf' # 20Oct2021 initial #] QNial_user_symbol_changes_loaddef_core IS - loaddef core working files for this project # see : 'QNial usrWkSpc symbol changes.ndf' # 20Oct2021 initial # loaddefs link d_Qndfs 'QNial userWkspSymbol.ndf' - #] build_userWkspSymbol IS - create [noun, adjective, verb, adverb, checkArg, etc] lists #] usr_WkspcSym_status IS - user WorkSpace status [memory, symbols, ndf files] #] DEPENDS on what has been loadded! Usually, that only happens at qnial startup. #] initial core loaddef is [fault, bool, array, list, string, fileop], + a few others #08********08 #] +-----+ #] From d_Qndfs 'QNial [symbol, arg] changes/QNial userWkspSymbol.ndf' #] dirL_ndfCountRecurse IS OP dirL - for each "top-level dir, #] sum recursive counts of files of given regexpr pattern in subDirs #] (kind of like du, but file counts, not sizes) dirL_ndfCountRecurse IS OP dirL { LOCAL dirBaseL pndfL ; pndfL := host_result link 'find "$d_Qndfs" -maxdepth 10 -type f -name "*.ndf" | grep --invert-match "z_Archive" | grep --invert-match "z_Old" ' ; dirBaseL := (pndfL EACHLEFT lst_strip_sub d_Qndfs) ; sub1stL := sortup ( ((`/ EACHRIGHT sub_posnAAllItmInTop_ary dirBaseL) + 1) EACHBOTH take dirBaseL ) ; countL := EACH sum (sub1stL EACHLEFT in dirL) ; transpose mix sub1stL countL } # initially built for : baseDirL := sortup 'video production' 'IJCNN 2013 Dallas TX' 'dictionaries' 'MindCode' 'email fix Thunderbird' 'uni2ascii' 'iconv - Unicode to ASCII' 'economics, markets' 'webSite' 'Cheng - semi-tensor and switching control, Matlab toolbox' 'email - mass response processing' 'Ord Diff Eq Integration' 'email' 'Bessel' 'USB_backup' 'Examples' 'Bessell - Runge-Kutta' 'Climate and Sun' 'symbols' dirL := d_Qndfs EACHRIGHT link baseDirL # qnial> dirL := host_result link 'find "$d_Qndfs" -maxdepth 10 -type f -name "*.ndf" | grep --invert-match "z_Archive" | grep --invert-match "z_Old" ' # dirL_ndfCountRecurse dirL #] List usage of one of Howells QNial [optr,var,etc]s - bash command line, substitute for #] actually good for any text in .ndf files # find "$d_Qndfs" -name "*.ndf" | grep --invert-match "z_Old" | grep --invert-match "z_Archive" | sort | tr \\n \\0 | xargs -0 -IFILE grep --with-filename --line-number "" "FILE" # may want saved to file : >"$d_temp""optr_usage temp.txt" #08********08 #] +-----+ #] Oddball stuff #] path_write_strLAposUnbalanced path - write lines of path with unbalanced apos # enddoc