- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Perl question
Operating System - HP-UX
1820299
Members
2975
Online
109622
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
07-07-2004 09:21 PM
07-07-2004 09:21 PM
Perl question
Hi all
I have the following file to be processed :-
jube99_04070806
I need to process the file for pattern recognition so that I am left with the following :-
jube99_........
i.e substitute everything after the _ with dots. The dots should be substituted as a partial string with th ~= notation.
I just cannot seem to be able to get the right substitution.
Thanks for any help
Jeff
I have the following file to be processed :-
jube99_04070806
I need to process the file for pattern recognition so that I am left with the following :-
jube99_........
i.e substitute everything after the _ with dots. The dots should be substituted as a partial string with th ~= notation.
I just cannot seem to be able to get the right substitution.
Thanks for any help
Jeff
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2004 01:05 AM
07-09-2004 01:05 AM
Re: Perl question
I'm not sure what you mean by the following file ot be processed?
#!/bin/contrib/bin/perl -w
{
$foo = "jube_04070806";
$foo = s/jube_.*/jube_......../;
print "$foo \n"l
}
Produces
jube_......
Or do you mean you want to read a directory and process all files like
jube_05070806
jube_04070808
.
.
.
Then you might
#!/usr/contrib/bin/perl -w
{
opendir (DIRECTORY,$myDirectory) or
die "cannot open $myDirectory;
@myFiles = readdir(DIRECTORY);
foreach $file(@myFiles){
## You might want to anchor to the first
## position with the ^ so that you get
## jube_stuff and not stuff_jube_morestuff
if ($file =~ /^jube_.*/) {
############################################
# Your File Processing Logic Here ############################################
}
}
closedir DIRECTORY;
}
-Good Luck
#!/bin/contrib/bin/perl -w
{
$foo = "jube_04070806";
$foo = s/jube_.*/jube_......../;
print "$foo \n"l
}
Produces
jube_......
Or do you mean you want to read a directory and process all files like
jube_05070806
jube_04070808
.
.
.
Then you might
#!/usr/contrib/bin/perl -w
{
opendir (DIRECTORY,$myDirectory) or
die "cannot open $myDirectory;
@myFiles = readdir(DIRECTORY);
foreach $file(@myFiles){
## You might want to anchor to the first
## position with the ^ so that you get
## jube_stuff and not stuff_jube_morestuff
if ($file =~ /^jube_.*/) {
############################################
# Your File Processing Logic Here ############################################
}
}
closedir DIRECTORY;
}
-Good Luck
"Only he who attempts the absurd is capable of achieving the impossible
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP