Supposed I had a buffer in emacs with 1000 lines, and dotted around in that buffer were unicode references (eg. \u8226
). I want to collect all those references into another buffer, which I can then sort and uniquify.
On the (*nix) command line, I can do something like:
grep -o "\\\\u[0-9]*" tmpfile | sort | uniq
Is this achievable directly within emacs, without saving any buffers to disk?
Go to your buffer, select it all with C-x h
, then do M-| grep -o "\\\\u[0-9]*" | sort | uniq
(this runs shell-command-on-region
). The output will go to *Shell Command Output*
, which will not be shown unless the output is long enough, but it's always created and you can switch to it regardless.
There is also occur
(M-s o
).
M-x occur RET [[:nonascii:]]+ RET M-x other-window M-x toggle-read-only M-x sort-lines
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With