Manipulate or parse file contents - Linux Commands

 title: grep

grep searches for matching words or line on the file To search entire directory of files, supply the directory name

grep -r 'Hello' .

By default grep is case sensitive (a is not the same as A) but you can ignore case by using the i switch

grep -i 'lINUX' hello

Tips and tricks:

To display line numbers:

grep -n 'linux' hello

To display lines that don't match the pattern:

grep -v 'world' hello

diff hello linux.txt

title: diff

File contents are sorted.Remember,we have two files new.txt and linux.txt.lets compare them

diff hello linux.txt

Compare files line by line. < denotes first file(hello) and > denotes second file(linux.txt). you can compare three files with

diff3 hello new.txt linux.txt

title: diff3

Comments

Popular posts from this blog

Read and Navigate XML - Beautiful Soup

difference-between-stream-processing-and-message-processing

WordNet in Python