aws s3 ls | awk '{print $3}' | grep -v do-not-delete | xargs -L 1 -I {} aws s3 rb s3://'{}' --force
Friday, October 12, 2018
Wednesday, June 27, 2018
View a very long line in unix terminal using VIM editor
Steps to view a very long line in vim
- Open the file in vim
- Goto very long line
- write that line to temp file
- exit vim
- cat that temp file
Commands
- vim my_log_file.log
- :2345
- :2345w /tmp/very_long_line.txt
- :q!
- cat /tmp/very_long_line.txt
Tuesday, May 15, 2018
Directly open gz log files in vim
To open .gz which has log files directly in vim editor
create or update .vimrc file with below code
create or update .vimrc file with below code
augroup gzip
autocmd!
autocmd BufReadPre,FileReadPre *.gz set bin
autocmd BufReadPost,FileReadPost *.gz '[,']!gunzip
autocmd BufReadPost,FileReadPost *.gz set nobin
autocmd BufReadPost,FileReadPost *.gz execute ":doautocmd BufReadPost " . expand("%:r")
autocmd BufWritePost,FileWritePost *.gz !mv <afile> <afile>:r
autocmd BufWritePost,FileWritePost *.gz !gzip <afile>:r
autocmd FileAppendPre *.gz !gunzip <afile>
autocmd FileAppendPre *.gz !mv <afile>:r <afile>
autocmd FileAppendPost *.gz !mv <afile> <afile>:r
autocmd FileAppendPost *.gz !gzip <afile>:r
augroup END
vim apple.gz will open the log file directly in the editor
Reference : https://stackoverflow.com/questions/5396363/how-to-open-gzip-text-files-in-gvim-without-unzipping
Subscribe to:
Posts (Atom)