Linux Tips: Display targeted contents of all files on current directory

Linux Tips: Display targeted contents of all files on current directory

 

Part 1:-

 

// Just replace abcdefg with your required keywords

// Just use the following command:

 

#  grep -rn . -e "abcdefg"


Part 2:-

// If you want the above contents to be transferred onto a file

// Do the following:

 

# grep -rn . -e "" >files.txt


Part 3:-


// If you want the content on files.txt to be sorted

// Do the following (using natural sort):


# sort -V files.txt




Comments