Grep for windows shell12/13/2023 ![]() ![]() Grep finished with no matches found at Tue Apr 05 15:37:47 Warning: extra args ignored after 'grep "│\' Today i need to grep pages containing that character.Ĭalling Meta+ x grep in emacs with grep -inH -e "│" *html returns a error: -*- mode: grep default-directory: "c:/Users/xah/web/xahlee_org/emacs/" -*. In my vocabulary page Wordy English - the Making of Belles-Lettres, i use the Unicode BOX DRAWINGS LIGHT VERTICAL “│” as a temp marker for processing the word list. Here's a concrete example of grep problem. Example of a Real World Problem Using Grep Inside Emacs (extending the limit of unix tools is how Perl was born in 1987.) I need to find all occurrences of HTML “img” tag that are not wrapped by a tag. Unix grep and associated tool (sort, wc, uniq, pipe, sed, awk, etc.) is not flexible, when your need is slightly more complex. grep is Not Powerful Enough for Nested Syntax (For example, HTML/XML) Also, GNU grep supports a varieties of confusing regex (“-basic-regexp”, “-extended-regexp”, “-perl-regexp”.) It's too painful to figure them out and remember their details. The different versions accept different options. Linuxes typically come with GNU versions. Mac OS X comes with BSD versions, but some utils are GNU versions. There are too many versions and varieties of grep. With a script in Perl, Python, elisp, it's much easier to control. (For example, find/xargs), but their order and syntax is complex and tool Some unix tools provide these options, sometimes by combination of tools ![]() Only the first 2 levels, or a combination of the above in a specific order. ![]() Sometimes you want to exclude some files by list or by pattern, sometimes Sometimes you need to work on a list of files, sometimes by a pattern, You have to do it like this: grep -r 'xyz' -include='*html' dirname There's -r option, but then you can't specify file pattern (For example, *html). Grep is not very flexible for working with all files in a directory. Grep Not Flexible for Specifying Files in Directories Shell escape this string would be very inconvenient, and more complex when shell is used inside emacs. Here's a example of a string i need to do a literal search: ch_client="polyglut" ch_width=550 ch_height=90 ch_type="mpu" ch_sid="Chitika Default" ch_backfill=1 ch_color_site_link="#00C" ch_color_title="#00C" ch_color_border="#FFF" ch_color_text="#000" ch_color_bg="#FFF" (For example, a snippet of HTML that contains JavaScript and span multi-lines.) You could put your search string in a file with grep using -file= file_name, but this is not convenient. It may be long, containing 300 hundred chars or more. Sometimes you want to search a string that's part of source code. See: Linux Shell Util uniq Unicode Bug Problem with Long Search String Įven on Linux terminal, shell tools have issues with Unicode. However, calling unix grep inside emacs has some problems, either directly by a shell-command command, or indirectly by emacs lisp wrapper commands. Because, emacs has commands that act as wrapper to unix grep, with the advantage that the output is colored, and file names are linked. This page describes problems of calling unix grep in emacs, and why a emacs lisp version is more flexible and superior. xah talk show why unix grep sucks, history of regex, WolframLang StringExpression Grep -R '-include=*.' directly following the '.' token, include that token.By Xah Lee. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |