- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Perl Data Processing
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
06-02-2010 03:28 AM
06-02-2010 03:28 AM
my data file looks like; (delimited with ",")
Date,Time,Name,
05-27-2010,00:30,Isbl
Solved! Go to Solution.
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2010 03:43 AM
06-02-2010 03:43 AM
SolutionOther than skipping the header and potentially any lines that don't begin with a number in the first field, your request is sparse.
That said, you could do:
# perl -ne 'print if /^\s*\d/' file
...or:
# perl -ne 'next unless /^\s*\d/;print' file
...or:
# perl -e 'while (<>) {next unless /^\s*\d/;print}'
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2010 05:56 AM
06-02-2010 05:56 AM
Re: Perl Data Processing
This is good, do I have to call it out of my script ? OR can I embed to my code ? How can I embet this code clause ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2010 06:11 AM
06-02-2010 06:11 AM
Re: Perl Data Processing
This is good, do I have to call it out of my script ? OR can I embed to my code ? How can I embet this code clause ?
In a shell program you can simply in-line the code like:
...
echo "processing ${FILE}"
perl -ne 'print if /^\s*\d/' ${FILE}
...
If you want more than a commandline script we can create a "full" Perl script that looks just like any command or shell script that you would otherwise call from a shell.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2010 08:26 AM
06-02-2010 08:26 AM
Re: Perl Data Processing
You ought to take a look at Text::CSV (or Text::CSV_XS for faster processing);
$ cpan Text::CSV_XS
$ perldoc Text::CSV_XS
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2010 11:41 PM
06-02-2010 11:41 PM
Re: Perl Data Processing
You ought to take a look at Text::CSV (or Text::CSV_XS for faster processing);
Hi , is this the right doc. you recommended?
http://search.cpan.org/dist/Text-CSV_XS/
Regards,
Hakki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2010 04:46 AM
06-03-2010 04:46 AM
Re: Perl Data Processing
The link to Text::CSV_XS that Merijn posted will also show you the documentation. You can also use:
http://search.cpan.org/dist/Text-CSV_XS/CSV_XS.pm
By using his module you avoid beginning to slide down a slippery slope as first your comma-delimited data begins to contain quoted fields with embedded commas to separate subfields :-) Handling cases like that would cause you to re-invent what already works!
Regards!
...JRF...