Here you will find more than 50000 job interview questions

Job Questions Search Engine


Sponsored Links

How to use find command with grep command

September 7, 2010 by bigboss · Leave a Comment
Filed under: Unix Command Interview Questions 

Manages arguments passed to another command. This is often used either to increase efficiency (avoiding calling a command once for each argument) or to overcome shell environment limits (“Argument list too long”). It works by collecting arguments and invoking your command.

xargs is used to pass command arguments to the other process . So if we want to transfer output of the find command to the grep command we can use xargs.

find . -type f -print | xargs grep ‘oldmonk”

This command will search for all file in the current directory recusively (only file not directory) which contain ‘oldmonk’

How to recursive search in the directory

September 7, 2010 by bigboss · Leave a Comment
Filed under: Unix Command Interview Questions 

The wrong grep command would be

> grep 192.168.1.1 /etc/*.*

The above command would search in only one directory etc

The right command to search in the directory and recursively in subdirectory would be 
grep '192.168.1.1' /etc -d recurse

Explain grep command ?

September 7, 2010 by bigboss · Leave a Comment
Filed under: Unix Command Interview Questions 

GREP COMMAND INTERVIEW QUESTIONS  UNIX SHELL COMMAND

GREP is a powerful tool  to   search a pattern in the files

Usage/Synatax:

1. grep “search pattern”  “filename”

2. cat filename | grep “search pattern”

By default grep prints all the line containing the patterns

e.g to find telephone no : like 454-6746

grep "[[:digit:]]\{3\}[ -]\?[[:digit:]]\{4\}" file

//Spaces with hello and spaces …

grep "^[[:space:]]*hello[[:space:]]*$" file


  • Categories

    |
  • Tags

    ADO.NET Questions Algorithm Questions ASP.NET Questions auto_ptr Binary tree questions C++ Constructor Interview Questions C++ Questions CISCO Exams Questions Common Interview Questions Core Java Interview Questions Csharp Questions datastructure questions Delphi 6 find command gdb interview questions grep interview questions IBM certification exams questions Infosys Puzzles Java Struts Linked List Problem Linux Command Questions List Manager Interview Questions Markov Algorithm memory leakage mysql Interview Questions Normalization Oracle Application Developer Certification Exam Interview Questions Oracle Questions Perl Questions PHP Questions Pointers Interview Questions PostgreSQL Database Questions pthread interview questions Smart Pointer Solaris Interview Questions SQL SERVER Interview Questions STL STL Map Symbian OS Tricky Interview Questions Unix Interview Questions unix shell Vector Windows OS Questions