- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: scripting 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
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
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
тАО06-10-2002 05:44 AM
тАО06-10-2002 05:44 AM
The pattern is randomly placed in the file,but has a common 1st two chars. followed by 8 diff. chars.
eg.
INPUT DATA
This is a test data XYxxxxxxxx
Data XYmmmmm_mm could be any where in the file
Need to only extract XYaaaaaaaa
OUTPUT
XYxxxxxxxx
XYmmmmm_mm
XYaaaaaaaa
....
Is it possible to do this ?? Please help I am brain dead ... can't think of anything..really.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2002 05:54 AM
тАО06-10-2002 05:54 AM
Re: scripting question
open(INP,"
chomp;
while (/(XY[^\s]*)/g) {
print $1,"\n";
}
}
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2002 06:20 AM
тАО06-10-2002 06:20 AM
Re: scripting question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2002 06:23 AM
тАО06-10-2002 06:23 AM
Solutionwhile (/(XY[^\s]*)/g) {
to
while (/(XY........)/g) {
In your sample, you had a value with _mm appended which made it more than 8 characters so I wasn't sure if you needed the characters up to the next blank character or end of line.
Good Luck
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2002 06:27 AM
тАО06-10-2002 06:27 AM
Re: scripting question
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2002 06:28 AM
тАО06-10-2002 06:28 AM
Re: scripting question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2002 06:52 AM
тАО06-10-2002 06:52 AM
Re: scripting question
cat DATA | tr -cs "[:alnum:][:punct:]" "[\012*]" | grep XY
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2002 06:52 AM
тАО06-10-2002 06:52 AM
Re: scripting question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2002 06:57 AM
тАО06-10-2002 06:57 AM
Re: scripting question
See documentation on m//g. "g" allows to search multiple times through the same line.
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2002 07:03 AM
тАО06-10-2002 07:03 AM
Re: scripting question
This will hit those "words" starting with XY with only a length of eight:
cat DATA | tr -cs "[:alnum:][:punct:]" "[\012*]" | grep "^XY\(.\)\{8\}$"
ignoring anything like XYabcdefghijk
live free or die
harry