Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 762  / 2 Years ago, wed, may 25, 2022, 11:31:58

I have three files testx,testy and testz all in same directory Sikh. All three files contain same data or content. The contents are:



aaabb  Aaaaa  AAAAA 

bbbcc Bbbbb BBBBB

ff–ff Ccccc CCCCC

cccdd Ddddd DDDDD


Now I want to display the text containing A in all three files. What I have done so far is:



 grep '^A'*


But it does not display anything. So can anyone help me sort this out.


More From » grep

 Answers
1

It doesn't show anything, because your Text has no ^A in it.



The ^ means "Beginning of line". And you have no line that begins with a Capital A.



You could search with:



grep "A" *


This will find the AAAAA in your first Line.



Or search for example:



grep "^a"


That finds the aaabb line in your text.



Grep is case sensitive.


[#28384] Thursday, May 26, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tudatchful

Total Points: 270
Total Questions: 109
Total Answers: 122

Location: Palau
Member since Tue, May 30, 2023
1 Year ago
;