Write a grep (or grep) command that selects the lines from
a file that have exactly three characters.

Answers were Sorted based on User's Feedback



Write a grep (or grep) command that selects the lines from a file that have exactly three characte..

Answer / suvarna

grep -w "[a-z][a-z][a-z]" file_name

Is This Answer Correct ?    0 Yes 0 No

Write a grep (or grep) command that selects the lines from a file that have exactly three characte..

Answer / vawani

grep -x ^...$ <File Name>

Is This Answer Correct ?    0 Yes 0 No

Write a grep (or grep) command that selects the lines from a file that have exactly three characte..

Answer / mahfooz

grep [a-z][a-z][a-z] filename

Is This Answer Correct ?    2 Yes 3 No

Write a grep (or grep) command that selects the lines from a file that have exactly three characte..

Answer / saravan

Sorry use the below commands to get the exact word contains
3 char in the file.

grep -w "[a-zA-Z][a-zA-Z][a-zA-Z]" <filename>

Is This Answer Correct ?    1 Yes 2 No

Write a grep (or grep) command that selects the lines from a file that have exactly three characte..

Answer / jyoti pruthi

grep -n "..." <filename>

It will give u the lines that have only 3 characters with
line numbers. Here, "..." replace any 3 characters (single
dot represent single character).

Is This Answer Correct ?    0 Yes 1 No

Write a grep (or grep) command that selects the lines from a file that have exactly three characte..

Answer / niranjan

1)grep ??? filename

2)grep ^...$ filename

Is This Answer Correct ?    0 Yes 1 No

Write a grep (or grep) command that selects the lines from a file that have exactly three characte..

Answer / manideep

grep "..." <filename>

Is This Answer Correct ?    6 Yes 8 No

Write a grep (or grep) command that selects the lines from a file that have exactly three characte..

Answer / udhaya

grep ^???$ <filename>

Is This Answer Correct ?    2 Yes 5 No

Write a grep (or grep) command that selects the lines from a file that have exactly three characte..

Answer / rahul

grep -nw <charvalue> <filename>

Is This Answer Correct ?    1 Yes 7 No

Write a grep (or grep) command that selects the lines from a file that have exactly three characte..

Answer / chakri

grep -a filename

Is This Answer Correct ?    2 Yes 8 No

Post New Answer

More Unix Commands Interview Questions

Differentiate cat command from more command.

0 Answers  


What is the use of egrep command in unix?

0 Answers  


Which Command is Used for temprary switch User?

5 Answers   BitWise, IBM,


How do I run a whois command?

0 Answers  


how to check a file system type

7 Answers   Wipro,






What is the use of find command in unix?

0 Answers  


What is the use of touch command in there?

1 Answers   Accenture,


what is mount ,tell me about mount ,how can u use in real time project??

12 Answers   Symphony,


How can we "forked" process in UNIX? How then recognize in any of the branches we?

2 Answers   NIIT,


If JFS file system is 100% full how we can increase the file system ?

3 Answers  


What is the command to compare two files in unix?

0 Answers  


What do chmod command do?

0 Answers  


Categories