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

what does the command 'wc' do?

4 Answers  


What are the unix commands?

0 Answers  


what is the use of ls -l command & what is the information it gives about user ?

5 Answers  


How would you find the size of a file or directory?

1 Answers  


What does the command '$ls | wc –l > file1' do?

0 Answers  


What is time_t?

0 Answers  


What is the comma to show the space allocation of files?

0 Answers  


What is the functionality of a top command?

0 Answers   Amazon,


Explain iostat, vmstat and netstat.

3 Answers   CTS, Wipro,


What does sed command do in unix?

0 Answers  


What does the metacharacter mean?

0 Answers  


What is awk command used for?

0 Answers  


Categories