Click here

Tuesday, January 24, 2017

Bash useful commands


1) To find the duplicates in a file

cat $filename | sort | uniq -c  | awk '$1 > 1 {print $2}'

sort  To sort contents of a file
uniq -c   Counts number of duplicates in a file
awk '$1 > 1 {print $2}'  Print values which has count greater than 1 (Duplicates)


2) Replace a text in vim editor

shift +R   To replace mode

3) Copy the entire file in vim editor

From top
shift + v  To enter visual mode
shift+gg  To Select the entire file

From bottom

shift + v  To enter visual mode
shift  1G To Select the entire file

No comments:

Post a Comment

Omicron - people gathers in crowd

Amidst omicron thread, people are gathered in crowd at markets and public places to buy their daily needs. Because of full lockdown at Sunda...