Notepad++ 에서는 TextFX 라는 플러그인을 이용하면 된다. 안타깝게도 이 플러그인은 32bit 용만 제공된다.
플러그인 설치 후 재시작하면 TextFX 메뉴가 보인다. 먼저 TextFX > TextFX Tools > +Sort outputs only UNIQUE (at column) lines 를 체크한다. 적용할 문자열을 선택하고 위에 있는 Sort lines case sensitive (at column) 이나 Sort lines case insensitive (at column) 을 선택하면 중복이 제거된 정렬된 문자열을 획득할 수 있다.
long 형식의 경우 윈도우즈 Visual C++ 의 경우 32bit 로 처리되고 unix 에서는 64 bit 로 처리된다. max 가 다르니 cast 도 주의해야겠지만 이번에 겪은 문제는 long* 에 int * 주소를 넘기는 바람에 access violation 을 일으켰다.
$ grep -v "WARN" log.txt
2022-03-19 1:22 | FATAL | fatal
2022-03-19 1:23 | ERROR | error
2022-03-19 1:24 | INFO | info
2022-03-19 1:22 | FATAL | no fatal
2022-03-19 1:23 | ERROR | no error
-v 는 invert match 라고 한다.
$ grep --help
Usage: grep [OPTION]... PATTERN [FILE]...
Search for PATTERN in each FILE.
Example: grep -i 'hello world' menu.h main.c
Pattern selection and interpretation:
-E, --extended-regexp PATTERN is an extended regular expression
-F, --fixed-strings PATTERN is a set of newline-separated strings
-G, --basic-regexp PATTERN is a basic regular expression (default)
-P, --perl-regexp PATTERN is a Perl regular expression
-e, --regexp=PATTERN use PATTERN for matching
-f, --file=FILE obtain PATTERN from FILE
-i, --ignore-case ignore case distinctions
-w, --word-regexp force PATTERN to match only whole words
-x, --line-regexp force PATTERN to match only whole lines
-z, --null-data a data line ends in 0 byte, not newline
Miscellaneous:
-s, --no-messages suppress error messages
-v, --invert-match select non-matching lines
-V, --version display version information and exit
--help display this help text and exit
Output control:
-m, --max-count=NUM stop after NUM selected lines
-b, --byte-offset print the byte offset with output lines
-n, --line-number print line number with output lines
--line-buffered flush output on every line
-H, --with-filename print file name with output lines
-h, --no-filename suppress the file name prefix on output
--label=LABEL use LABEL as the standard input file name prefix
-o, --only-matching show only the part of a line matching PATTERN
-q, --quiet, --silent suppress all normal output
--binary-files=TYPE assume that binary files are TYPE;
TYPE is 'binary', 'text', or 'without-match'
-a, --text equivalent to --binary-files=text
-I equivalent to --binary-files=without-match
-d, --directories=ACTION how to handle directories;
ACTION is 'read', 'recurse', or 'skip'
-D, --devices=ACTION how to handle devices, FIFOs and sockets;
ACTION is 'read' or 'skip'
-r, --recursive like --directories=recurse
-R, --dereference-recursive likewise, but follow all symlinks
--include=FILE_PATTERN search only files that match FILE_PATTERN
--exclude=FILE_PATTERN skip files and directories matching FILE_PATTERN
--exclude-from=FILE skip files matching any file pattern from FILE
--exclude-dir=PATTERN directories that match PATTERN will be skipped.
-L, --files-without-match print only names of FILEs with no selected lines
-l, --files-with-matches print only names of FILEs with selected lines
-c, --count print only a count of selected lines per FILE
-T, --initial-tab make tabs line up (if needed)
-Z, --null print 0 byte after FILE name
Context control:
-B, --before-context=NUM print NUM lines of leading context
-A, --after-context=NUM print NUM lines of trailing context
-C, --context=NUM print NUM lines of output context
-NUM same as --context=NUM
--color[=WHEN],
--colour[=WHEN] use markers to highlight the matching strings;
WHEN is 'always', 'never', or 'auto'
-U, --binary do not strip CR characters at EOL (MSDOS/Windows)
When FILE is '-', read standard input. With no FILE, read '.' if
recursive, '-' otherwise. With fewer than two FILEs, assume -h.
Exit status is 0 if any line is selected, 1 otherwise;
if any error occurs and -q is not given, the exit status is 2.
Report bugs to: bug-grep@gnu.org
GNU grep home page: <http://www.gnu.org/software/grep/>
General help using GNU software: <http://www.gnu.org/gethelp/>
(1) 다른 프로그램이 같은 파일을 고치고 있는중일 수 있습니다.
만약 그렇다면 같은 파일을 두 개의 프로그램에서 고치지 않도록
조심하시기 바랍니다. 종료하세요. 계속하시려면 주의하세요.
(2) 이 파일을 고치다가 죽었었습니다.
만약 그렇다면 ":recover" 혹은 "vim -r a.txt"
을 사용하여 복구하십시오 (":help recovery" 참고).
이미 복구하셨었다면 스왑파일 ".a.txt.swp"
을(를) 지우셔야 이 메시지가 사라집니다.
스왑 파일 ".a.txt.swp"이 이미 존재합니다!
읽기 전용으로 열기([O]), 그냥 고치기((E)), 복구((R)), 끝내기((Q)), 버리기((A)):
오랜만에 linux 에서 작업하고 있다. ssh 접속해서 서버 로그를 vi 로 볼 일이 많다. 여러 사람이 같이 보다 보면 읽기 전용으로 열 것인지 물어보는 게 신경쓰인다.
$ vi --help
VIM - Vi IMproved 8.2 (2019 Dec 12, 빌드한 날짜 Jun 1 2020 06:42:35)
사용법: vim [인자] [파일 ..] 주어진 파일 고치기
혹은: vim [인자] - 표준입력에서 텍스트 읽기
혹은: vim [인자] -t tag 태그가 정의된 위치에서 파일 고치기
혹은: vim [인자] -q [에러파일] 첫 번째 에러가 난 파일 고치기
인자:
-- 이 뒤에는 파일 이름만
-v Vi 모드 ("vi"와 같음)
-e Ex 모드 ("ex"와 같음)
-E 향상된 Ex 모드
-s 조용한 (배치) 모드 ("ex"만)
-d Diff 모드 ("vimdiff"와 같음)
-y 쉬운 모드 ("evim"과 같음, modeless)
-R 읽기 전용 모드 ("view"와 같음)
-Z 제한된 모드 ("rvim"과 같음)
-m 수정(파일 쓰기)이 허용되지 않음
-M 텍스트 수정이 허용되지 않음
-b 이진 상태
-l 리스프 상태
-C Vi 호환: 'compatible'
-N Vi와 호환되지 않음: 'nocompatible'
-V[N][fname] Be verbose [level N] [fname에 메시지 저장]
-D 디버깅 모드
-n 스왑 파일 없이 메모리만 사용
-r 스왑 파일 목록을 표시한 뒤 끝내기
-r (파일 이름과 함께) 파손되었던 세션 복구
-L -r과 같음
-A Arabic 모드로 시작
-H Hebrew 모드로 시작
-T <terminal> 터미널 종류를 <terminal>로 설정
--not-a-term 터미널에 입출력할 수 없다는 경고하지 않음
--ttyfail 터미널에 입출력할 수 없는 경우 종료
-u <vimrc> .vimrc 대신 <vimrc>를 사용
--noplugin 플러그인 스크립트를 불러들이지 않음
-p[N] N개의 탭 열기 (기본: 파일별로 하나)
-o[N] N개의 창 열기 (기본: 파일별로 하나)
-O[N] -o와 같지만 창을 수직으로 나누기
+ 파일 마지막에서 시작
+<lnum> <lnum> 줄에서 시작
--cmd <명령> vimrc 파일을 읽기 전에 <명령>을 실행
-c <명령> 첫째 파일을 읽은 뒤 <명령>을 실행
-S <세션> 첫째 파일을 읽은 뒤 <세션> 파일 불러 들이기
-s <scriptin> <scriptin> 파일에서 Normal 상태 명령 읽기
-w <scriptout> 모든 입력된 명령을 <scriptout> 파일에 추가
-W <scriptout> 모든 입력된 명령을 <scriptout> 파일에 저장
-x 암호화된 파일 고치기
--startuptime <file> startup timing 메시지를 <file>에 저장
-i <viminfo> .viminfo 대신 <viminfo>를 사용
--clean 'nocompatible', Vim defaults, no plugins, no viminfo
-h 혹은 --help 도움말(이 메시지)을 출력한 뒤 끝내기
--version 판 정보를 출력한 뒤 끝내기
$ vi -R <filename>