Regex-1.1 Regular Expression Introduction

Make sure to subscribe to my channel for more videos on UNIX, Perl and SQL.
twitter: @fuzicast

\w – matches a alphanumeric character
\d – matches a number
\s – matches a space
\W, \D, \S – opposite of \w, \d, \s
^ – beginning of line
$ – end of line character
. – match any character except for newline
* – 0 or more occurrence
+ – 1 or more occurrence
? – 0 or 1 occurrence
| – alternative match
(regex) – grouping/store match
[ ] – character set/class
{ x,y } – number of occurrence between x and y
{ x } – x occurrence
{ x, } – at least x occurrence
[^ ] – opposite of [ ]
*? – non greedy matching

VIM-1.2 VIM Commands

Make sure to subscribe to my channel for more videos on UNIX, Perl and SQL.
twitter: @fuzicast

:x – save and quit
ctrl + z – bring editor to background
fg – bring back editor
~ – change character case
U – undo all the changes to that line
vi” – select content between quotes for that line
ctrl+v, select multiple “print” statements on multiple rows, press s, then type “say” statement, press esc and enter
shift + v – highlight whole line, move up and down to select multiple lines
y – copy highlighted lines
p – paste whatever copied from y
yy – copy whole line
select multiple lines and search replace
>> – shift right
<< – shift left
V + – shift multiple lines
V + d – delete multiple lines
:sav filename – save as another file
A – append at the end of line
:r filename – reads in another file and appended to the cursor
‘. – go back to the last edit position
view – read-only mode
:!command – execute unix command inside vim
:r! command – read in output from command
w – go to next word
b – go to previous word
w filename – writes highlighted lines to a file
:set nu – view line numbers
dw – delete characters up to empty space
cw – same as dw, but enters insert mode
:e! filename.txt – discard current file and changes, start editing new file
vimdiff file1 file2 – check differences between 2 files
ctrl +w twice – get to next split screen
:sp filename – split screen on filename
:vsp filename – vertical split screen on filename
:tabnew – open new tab
:tabm3 – rearranging your tab
gt – go to next tab