![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| regex | anchal_khare | Shell Programming and Scripting | 3 | 10-13-2008 06:24 AM |
| Regex | pppswing | Shell Programming and Scripting | 5 | 06-30-2008 11:22 PM |
| Regex | deepakpv | Shell Programming and Scripting | 6 | 03-28-2007 05:18 AM |
| Regex?? Please help | lunac | UNIX for Dummies Questions & Answers | 7 | 01-30-2007 01:13 PM |
| sed regex | Shakey21 | UNIX for Dummies Questions & Answers | 4 | 01-31-2002 09:16 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
RegEx for tv5XXXX
Hello Experts, This is regarding framing RegEx for the likes 'tv5XXXX'. Their are directories under say 'myFolder/' with names like: Code:
tv5abc1 tv5abc2 tv5jkh6 tv5jkhi . . and others out of my concern. I want to list all the directories of my required type. Their name must fulfill the following condition:
Code:
ls -l | awk '{print $9}' | grep "^\(tv5[a-z]\{3,4\}[0-9]\{1\}\)$"
The above snippet lists the likes of tv5ebc1, tv5abc2 etc. and not tv5abcd because it looks for a number in the end. What I think the solution to be is : Code:
ls -l | awk '{print $9}' | grep "^\(tv5[a-z]\{3\}{--either a digit or an alphabet--}\)$"
Please provide some hints to help me. Thank You. Regards |
|
||||
|
I wonder how I missed it. [0-9a-z] Problem resolved, I believe. Final Solution: Code:
ls -l | awk '{print $9}' | grep "^\(tv5[a-z]\{3\}[0-9a-z]\)$"
Still, if you find a test case I might have missed, please help me recognise it. Thank You. Regards PS: I'll post the complete script for review and reference as soon as it is complete.
|
![]() |
| Bookmarks |
| Tags |
| regex, regular expression conditions, regular expressions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|