- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: grep command
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
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
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
тАО03-07-2004 08:04 PM
тАО03-07-2004 08:04 PM
Help me please. I want to grep from a file where the first digit must be lower case character a-z, the second digit can be lower character or none, and followed by 4 digit number.
Example, a file called file1 contents :
a1234
aa1234
syssupport1
ac1511
aducate1234
using grep command,the result must be :
a1234
aa1234
ac1511
ap1030
Please help.
Thanks and Best Regards,
Negara
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-07-2004 08:13 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-07-2004 08:16 PM
тАО03-07-2004 08:16 PM
Re: grep command
Thanks and Best Regards,
Negara
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-07-2004 08:17 PM
тАО03-07-2004 08:17 PM
Re: grep command
cat file|
while read line
do
echo $line|grep ^[a-z][a-z][0-9][0-9][0-9][0-9]
echo $line|grep ^[a-z][0-9][0-9][0-9][0-9]
done
Steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-07-2004 08:20 PM
тАО03-07-2004 08:20 PM
Re: grep command
grep ^[a-z][a-z][0-9][0-9][0-9][0-9] file_nm
sks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-07-2004 08:40 PM
тАО03-07-2004 08:40 PM
Re: grep command
Best Regards,
Negara
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2005 09:06 AM
тАО10-11-2005 09:06 AM
Re: grep command
The above said grep commands are not exact.Take for example your file is like this.
a1234
aa1234
syssupport1
ac1511
aducate1234
a123456
Executing the above commands results in:
a1234
aa1234
ac1511
a123456 -- (this is not our desired output)
so, better try this.
cat filename | grep '^[a-z]*[a-z][0-9][0-9][0-9][0-9]$'
Thank you,
karthika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2005 06:30 PM
тАО10-11-2005 06:30 PM
Re: grep command
Enjoy, Have FUN! H.Merijn