--- title: "Console 筆記" path: "Console 筆記" --- {%hackmd @RintarouTW/About %} # Console 筆記 # Prompt ## ANSI Color https://blog.taylormcgann.com/tag/prompt-color/ ## Powerlevel9k https://github.com/Powerlevel9k/powerlevel9k # vim ## Color Themes https://vimcolors.com/ # bash ## check files exist or not ```bash #!/bin/bash if [ -e $1 ] then sed -e 's/old/new/g' "$1" fi ``` ## change all file names at once ```bash # change files' extension for file in *.txt;do b=`basename "${file}" .txt` mv "${b}.txt" "${b}.md" done ``` # sed **S**tream **Ed**itor Most GNU tools don't support `lookahead`/`lookbehind` regex yet. ```bash sed -E 's/\$\$(.+)\$\$$/$$ \1\ $$/g' filename ``` Delete the line which contains the keyword ```bash sed -e '/@RintarouTW\//d' filename ``` Delete range of lines ```bash sed '1,7d' filename ``` [More Examples](http://sed.sourceforge.net/sed1line.txt) # find ```bash find . -type f -name "*.md" ! -iname "ignore.file" -exec sed -i '' '/regex/' {} + ``` # awk ###### tags: `console` `bash` `sed` `find`