- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: perl script
Operating System - Linux
1753523
Members
11453
Online
108795
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
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
Go to solution
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
12-12-2005 02:25 PM
12-12-2005 02:25 PM
I am modified someone perl script. This script is using the writeexcel module to produce a excel file.
I have the following line which is actually create a new worksheet and named it using the file name in the directory.
($sheetname)=($file=~m#.*\d-(.+)\.csv#);
List of file in the directory
12-05-ABC_XXX_Filesystem.csv 12-05-MSESE-ABC_xxxsg-x_ExchIS.csv
12-05-ABC_Ksex_FS_Sun_BD.csv 12-05-MSESE-ABC_xxxx_Exch_Fri_AC.csv 12-05-MSSQL-ABC_xxxsgsap_PRD2_Diff.csv
12-05-ABC_xxx_FS_Wed_BD.csv
However, excel worksheet name has some limitation on the length of the name it can use.
I would like to cut down "12-05-", "MSSQL-", "MSESE-" from the file name so that the name can be shorter to use for the excel spreadsheet.
I have the following line which is actually create a new worksheet and named it using the file name in the directory.
($sheetname)=($file=~m#.*\d-(.+)\.csv#);
List of file in the directory
12-05-ABC_XXX_Filesystem.csv 12-05-MSESE-ABC_xxxsg-x_ExchIS.csv
12-05-ABC_Ksex_FS_Sun_BD.csv 12-05-MSESE-ABC_xxxx_Exch_Fri_AC.csv 12-05-MSSQL-ABC_xxxsgsap_PRD2_Diff.csv
12-05-ABC_xxx_FS_Wed_BD.csv
However, excel worksheet name has some limitation on the length of the name it can use.
I would like to cut down "12-05-", "MSSQL-", "MSESE-" from the file name so that the name can be shorter to use for the excel spreadsheet.
abc
Solved! Go to Solution.
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2005 03:09 PM
12-12-2005 03:09 PM
Solution
The 12-05 is just an example of a date no?
Will the month field be zero-filled, blank filled, or short in January?
Before that assignment line you can use:
$file =~ s/\s?\d+-\d\d(-MSSQL-|-MSESE-|-)//;
This replaces a matching string in $file with nothing.
The match requires
\s? = 0 or 1 space (January)
\d+ = 1 or more digits
- = a dash
\d\d = two digits
(a|b|c) = a, b, or c where a=-MSSQL, b=-MSESE, c= a dash.
Enjoy,
Hein.
Will the month field be zero-filled, blank filled, or short in January?
Before that assignment line you can use:
$file =~ s/\s?\d+-\d\d(-MSSQL-|-MSESE-|-)//;
This replaces a matching string in $file with nothing.
The match requires
\s? = 0 or 1 space (January)
\d+ = 1 or more digits
- = a dash
\d\d = two digits
(a|b|c) = a, b, or c where a=-MSSQL, b=-MSESE, c= a dash.
Enjoy,
Hein.
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.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP