Posts

why 'grep' is used mostly for searching a pattern, why not 'awk'?

Here is the short and sweet explanation of this question. grep is used to search for specific terms in a file which is different from awk , grep can't add/modify/remove the text in a specific file. But it's useful when we just want to search and filter out matches. awk can be considered as superset of grep . awk is more like a text processors which means it hasn't only have the ability to find out what you are looking for in text but it has ability to remove, add and modify the text as well. Why not use awk? We can use awk as well but it depends on what we want to do. There are things that are easier to do with one or the other.  As per my knowledge, grep is easier to use in regards to search a particular pattern. For instance, in order to search both " easylinux " and " EASYLINUX " from test.txt , using grep : grep -i  "easylinux" test.txt using awk : awk 'tolower($0) ~ /easylinux/' test.txt OR awk -v IGNORECASE=1...

GIT Tips & Tricks

In this post, I will try to explain some of the very useful commands I came across. if you use git daily then this post will make your task easy.  Let's start with an example, you are working on your local/working directory which means you have some local changes. Now, you want to pull the latest changes or sync your local repo with remote/master repo, you have to clean your working directory. So how do you save your local changes?  One answer could be to create a patch of changes and store somewhere and reapply that patch manually after syncing/updating your local repo, this is what I used to do earlier but I found it very tedious and annoying and I came across a very good git command " git stash " which does this very efficiently.  git stash Various operations which git stash can perform are like: git stash save - Take all the changes you have in your working directory and the index, and save them away, leaving you with a clean working directory git s...