Created
October 16, 2017 05:38
-
-
Save ishideo/4e9a0f21840f0dd5ed81ed38e7af4908 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-single.el log.txt '^\n.*\n' | |
(defun remove-match-lines (file regex) | |
(with-current-buffer (find-file-noselect file) | |
(goto-char (point-min)) | |
(while (re-search-forward regex nil t) | |
(replace-match "")) | |
(save-buffer))) | |
(defun replace-escape-new-line (str) | |
(replace-regexp-in-string "\\\\n" "\n" str)) | |
(let ((file (car argv)) | |
(regex (replace-escape-new-line (nth 1 argv)))) | |
(remove-match-lines file regex)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment