Sunday, January 12, 2014

Vi Editor Commands

To set line numbers in vi editor
###########################
:set nu
:1            --- It will take you to first Line
ptree -a   --- To see all child processes
:%s/x/y/g         To replace x by y
To remove spaces at the end of lines
#####################################

put the file into vi..

:%s/  //g

To append something at the begining

:%s/^/ /g          ---- to add spce at the begining..
:%s/^/krishna/g     ---- To add krishna at starting of the line

:%s/$/ /g                ---- To append space at the end

:%s/$/krishna/g          ---- To append krishna at the end

using sed

sed -n '/yyyy-mm-ddT12:00:00/,/yyyy-mm-ddT14:00:00/p' *****.log
Redirect to a file

sed -n '/yyyy-mm-ddT00:00:00.000-00:00/,/yyyy-mm-ddT00:00:00.000-00:00/p' ua2021-03-30-22-02-29PM.log > test.log

--> to search a string "RAM" in all subfolders and files

grep -r RAM */*

or
grep -r RAM <dir>

No comments:

Post a Comment