Last active
November 1, 2017 12:56
-
-
Save ishideo/19b06e828268d1be3982cf174b9c3432 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*- coding: utf-8; lexical-binding: t -*- | |
;; emacs -Q --script remove-match-lines-multiple.el log.txt | |
(defun remove-match-lines (file patterns) | |
(with-current-buffer | |
(find-file-noselect file) | |
(mapcar | |
(lambda (x) | |
(goto-char (point-min)) | |
(while (re-search-forward x nil t) | |
(replace-match "")) | |
(save-buffer)) | |
patterns))) | |
(let ((file (car argv)) | |
(patterns (list "^\n.*\n" "abc"))) | |
(remove-match-lines file patterns)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment