Jan 21, 2005 #1 TheDash MIS Mar 25, 2004 171 US Hi, I am trying to grep two words that end with ZZZ. They begin with AAA or BBB. Can somebody help with this? This won't work. egrep '^[AAA][ZZZ]$|^[BBB][ZZZ]$'
Hi, I am trying to grep two words that end with ZZZ. They begin with AAA or BBB. Can somebody help with this? This won't work. egrep '^[AAA][ZZZ]$|^[BBB][ZZZ]$'
Jan 21, 2005 1 #2 vgersh99 Programmer Jul 27, 2000 2,146 US egrep '^(AAA|BBB).*ZZZ$' file vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
egrep '^(AAA|BBB).*ZZZ$' file vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Jan 21, 2005 Thread starter #3 TheDash MIS Mar 25, 2004 171 US Hi what does the . in the middle do? Upvote 0 Downvote
Jan 21, 2005 #4 vgersh99 Programmer Jul 27, 2000 2,146 US .* . - any character * - preceeding character repeated 0 or more times vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
.* . - any character * - preceeding character repeated 0 or more times vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Jan 21, 2005 Thread starter #6 TheDash MIS Mar 25, 2004 171 US Hi.. I used it here .. ls -l dirname | egrep '^(AAA|BBB).*ZZZ$' to check for file names ... why doesn't it work? Upvote 0 Downvote
Hi.. I used it here .. ls -l dirname | egrep '^(AAA|BBB).*ZZZ$' to check for file names ... why doesn't it work?
Jan 21, 2005 #7 vgersh99 Programmer Jul 27, 2000 2,146 US 'couse.... "^" - stands for the BEGINNING of the line. What's the beginning of the line of 'ls -l'? vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
'couse.... "^" - stands for the BEGINNING of the line. What's the beginning of the line of 'ls -l'? vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Jan 21, 2005 Thread starter #8 TheDash MIS Mar 25, 2004 171 US ok, thanks ls -l dirname | egrep '.*(AAA|BBB).*ZZZ$' solved it. Upvote 0 Downvote
Jan 21, 2005 #9 vgersh99 Programmer Jul 27, 2000 2,146 US what about file: fooAAAbarZZZ.txt ? vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
what about file: fooAAAbarZZZ.txt ? vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Jan 21, 2005 #10 vgersh99 Programmer Jul 27, 2000 2,146 US I meant to say: fooAAAbarZZZ vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
I meant to say: fooAAAbarZZZ vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Jan 21, 2005 #11 jstreich Programmer Apr 20, 2002 1,067 US Or places where the user or group is AAA or BBB? Upvote 0 Downvote
Jan 21, 2005 #12 vgersh99 Programmer Jul 27, 2000 2,146 US hint: ls -l | egrep '.*[ ]+(AAA|BBB)[^ ]+ZZZ$' vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
hint: ls -l | egrep '.*[ ]+(AAA|BBB)[^ ]+ZZZ$' vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+