Posts

Introduction to vi

Introduction to vi Usually, the actual program installed on your system is vim , which stands for vi Improved , and is aliased to the name vi . When using  vi , all commands are entered through the keyboard; you do not need to keep moving your hands to use a pointer device such as a mouse or touchpad, unless you want to do so when using one of the graphical versions of the editor. vimtutor Typing vimtutor  launches a short but very comprehensive tutorial for those who want to learn their first vi  commands. This tutorial is a good place to start learning vi . Modes in vi vi provides three modes , as described in the table below. It is vital to not lose track of which mode you are in. Many keystrokes and commands behave quite differently in different modes. Mode Feature Command ·       By default, vi  starts in   Command mode. ·       Each key is an editor comma...
Getting Started:  Useful awk programs are often short, just a line or two. Suppose you have a file called emp.data that contains the name, pay rate in nrs per hour, and number of hours worked for your employees, one employee record per line, like this: Ramesh       4.00          0 Samjhana   3.75           0 Asmita        4.00           10 Sandesh      5.00           20 Rajesh         4.25           18 Now you want to print the name and pay (rate times hours) for everyone who worked more than zero hours. This is the kind of job that awk is meant for, so it's easy. prakash@prakash-VPCEB490X:~/Desktop$ awk ' $3 > 0 { print $ 1, ...

Permission and Ownership using awk

Image
Awk programming The easiest way to learn the awk command usage is to see them in action. In order to find the working directory we are in . Type pwd ( "print working directory" ) Then type ls ( listing)for listing to see what's in the current directory $ ls Permissions and Ownership List directories and files ls -al # shows something like this for each file/dir: drwxrwxrwx # d: directory # rwx: read write execute # first triplet: user permissions (u) # second triplet: group permissions (g) # third triplet: world permissions (o)     It shows like this when we type   $ls -al   drwxr-xr-x 2 prakash prakash 4096 Oct 27 03:56 Videos drwxr-xr-x 2 prakash prakash 4096 Nov 18 10:19 .vim -rw------- 1 prakash prakash 11158 Dec 16 18:54 .viminfo -rw------- 1 prakash prakash 124 Dec 16 18:11 .Xauthority -rw------- 1 prakash prakash 82 Dec 16 18:11 .xsession-errors Assign write and execute permission...