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

How do you repeat a command in terminal?

0 Answers  


How to get the operating system's information in unix?

6 Answers   IBM, TCS,


What command is used to replace the existing string with some other?

8 Answers   TCS,


What is grep and how do you use it?

0 Answers  


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

24 Answers   Mac, Nokia,






What is file system in unix??

10 Answers   Symphony,


How to create hardlinks and softlinks on files?

2 Answers  


How i'll delete a particular line from the file? Please give answer as soon as possible. Thanks in advance.

12 Answers   IBM,


when we installing aix os the ssh installed default?

2 Answers  


Give the command to display space usage on the UNIX file system.

6 Answers  


What is the use of awk command in unix?

0 Answers  


What UNIX command will control the default file permissions when files are created?

4 Answers  


Categories