<aside>
# Windows
tree /f
# Linux
ls -R
ls -aR
</aside>
<aside>
binwalk [filename]
Since spreadsheet files such as .xlsx and .xlsm are just compressed files, we can read the Macros in the format of XML files by extracting them from the excel files.
binwalk -e [filename]
</aside>
shutdown /r
shutdown /r /t 0
<aside>
# awk
awk '{$1=$1}1' filename.txt > output.txt
# sed (in place)
sed -i 's/[[:space:]]\\+$//' filename.txt
- `-i`: 파일을 직접 수정 (백업 없이)
- `s/.../.../`: 치환
- `[[:space:]]\\+$`: 줄 끝의 모든 공백 문자(스페이스, 탭 등) 제거
# 공백 없이 한 줄로 출력
tr -d '\\n\\r[:space:]' < hash.txt > hash_oneline.txt
</aside>
sed -n '2p;3p;7p' hosts.txt
awk 'NR==2 || NR==3 || NR==7' hosts.txt
cat file.txt | sed -n '2p;3p;7p'
some_command | awk 'NR==2 || NR==3 || NR==7'
# range
sed -n '2,5p' hosts.txt
# last column
awk '{print $NF}' file.txt
awk '{print $2}' file.txt
awk '{print $2, $3, $7}' file.txt
# 구분자가 공백이 아니라면
awk -F'\\t' '{print $2, $3, $7}' file.txt
awk -F',' '{print $2, $3, $7}' file.txt
# 출력 구분자 조정
awk '{print $2 ";" $3 ";" $7}' file.txt