일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
- GitLab
- ssh key 배포
- centos 8
- Kibana
- G-suite
- 한글가이드
- XCP-ng
- freebsd
- x-pack
- pfsense
- proxycfg
- hardening
- ELASTIC
- Windows
- docker
- PlayBook
- ansible
- macos
- miniconda
- Kibana server is not ready yet
- bash
- xe guest utilities
- Proxy
- endpoint security
- Elasticsearch
- application security
- 보안양파
- 로그인불가
- elastic stack
- Today
- Total
목록IT/Programming (66)
선 밖에 선 자유인
https://developer.mozilla.org/ko/docs/A_re-introduction_to_JavaScript
- 특정 문자열 포함 라인 중 특정 문자열 포함 필드 출력예) 파일 내용에서 three가 포함되며, three로 시작하는 필드 검색 one=1 two=2 three=3$ cat | grep "three" | awk '{ for(i=1; i
http://www.itworld.co.kr/slideshow/89265 - Melno 폰트 윈도용
테스트 #!/bin/bash num=1 result="result.txt" if [ -f $result ]; then rm -f ./$result fi for file in `cat file-list.txt` do type=`echo "$file" | awk -F "." '{print $2}'` count=`grep -c "$file" ` pi='None' grep "$file" | awk -F " - - " '{print $1}' | sort -u > ip.txt arr=() for line in `cat ip.txt` do line=`echo $line | tr -d ','` arr+=($line) done src=${arr[@]} fullpath=`grep "$file" full-path-file...
변수명 내용 FILENAME 현재 처리중인 파일명 FS 필드 구분자로 디폴트는 공백 RS 레코드 구분자로 디폴트는 새로운 라인 NF 현재 레코드의 필드 개수 NR 현재 레코드의 번호 OFS 출력할 때 사용하는 FS ORS 출력할 때 사용하는 RS $0 입력 레코드의 전체 $n 입력 레코드의 n번째 필드 예) 마지막 두 컬럼 출력awk -F "." '{if (NF >= 2) print $(NF-1)"."$(NF);}'
- recursive를 통해 하위 디렉터리에서 내용 추출 # 패턴으로 검색 find ./ -name '*.gz' -exec zgrep "" {} \; # regex를 통해 확장자 검색 find ./ -name '*.gz' -exec zgrep -E -i "\.xls|\.xlsx|.pdf" {} \;
가끔 UTF-8 포맷으로 저장된 csv 파일의 경우 엑셀이나 여러 프로그램에서 한글이 깨짐. 막 깨짐 간단한 파이썬 코드로 EUC-KR로 포맷 변경 #!/usr/bin/python import codecs infile = codecs.open('test.csv', 'r', encoding='utf-8') outfile = codecs.open('test2.csv', 'w', encoding='euc_kr') for line in infile: line = line.replace(u'\xa0', ' ') # 가끔 \xa0 문자열로 인해 오류가 발생하므로 변환 outfile.write(line) infile.close() outfile.close() 응용: 쉘 스크립트를 이용해 해당 디렉토리의 파일들 모두 ..