- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Regular Expression Question
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2003 02:40 AM
08-20-2003 02:40 AM
I've got a rather large shell script written in ksh, but I need to make a small modification to pick up a regular expression.
The requirement is to match either wordA or wordB in an "ls" command, but the expression that works in Posix, doesn't seem to work in ksh.
The Posix expression is:-
$ ls -l {FULL,INCR}BACKUP.log
Does anyone know an equiv. for ksh ???
(Thanks in advance for any/all help!!)
Rgds,
Paul.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2003 03:09 AM
08-20-2003 03:09 AM
Re: Regular Expression Question
I'm not known for my shell scripting, so take this with a grain of salt:
How about:
ls -l [FI][UN][LC][LR]BACKUP.log
?
Does that give you what you want?
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2003 03:12 AM
08-20-2003 03:12 AM
Re: Regular Expression Question
why not use grep?
ls -l | grep -e 'BACKUP.log$' -e 'FULL|INCR'
(not *exactly* yours but maybe you like this better:
ls -l *BACKUP.log | grep -e 'FULL|INCR'
or really exact and only:
ls -l | grep -e FULLBACKUP.log -e INCRBACKUP.log
Regards,
Bernhard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2003 03:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2003 03:44 AM
08-20-2003 03:44 AM
Re: Regular Expression Question
Leif's suggestion works.
Here are two other alternatives, too:
(1) Use the standard Posix shell ('/usr/bin/sh'). It is really a superset of the Korn (ksh88) shell as provided with HP-UX.
(2) Instead of the 1988 version of Korn, use the 1993 version. You should find it as '/usr/dt/bin/dtksh'.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2003 03:47 AM
08-20-2003 03:47 AM
Re: Regular Expression Question
....
/usr/bin/sh "ls -l {FULL,INCR}BACKUP.log"
....
Rgds,
JL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2003 03:50 AM
08-20-2003 03:50 AM
Re: Regular Expression Question
Leif's answer has provided exactly what I needed - many thanks !!!