- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: fixed length file manipulation - is there a be...
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
11-10-2004 06:43 AM
11-10-2004 06:43 AM
I'm thinking that there's got to be a better way.
I've attached the script I used as my solution -- what would your solution have been?
Cheers
Scott
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2004 06:50 AM
11-10-2004 06:50 AM
SolutionYour other option (as long as the records are 3000 characters or less) is awk. It too would be much more efficient. The Gnu version of awk, gawk, can handle arbitrarily large records to get around the 3K limit.
Learn Perl; that's my first choice but I ain't gonna code it for you because that's really doing you no favor.
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2004 06:58 AM
11-10-2004 06:58 AM
Re: fixed length file manipulation - is there a better way?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2004 07:00 AM
11-10-2004 07:00 AM
Re: fixed length file manipulation - is there a better way?
no line length limit
foreach my $filename (glob "flatord.*") {
open my $out ">$filename.new" or die "$filename.new: $!";
local @ARGV = ($filename);
while (<>) {
my ($f1, $nr, $f2, $dt, $f3) = unpack "a768 A16 a160 A4 a*", $_;
$nr = sprintf"%s%04d","X"x16,$nr%10000;
$dt =~ s/./X/g;
print $out "$f1$nr$f2$dt$f3";
}
close $out;
print "="x40,"\n"
Should be about the same, uses no temp files, is a single bloody fast process. Didn't test
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2004 07:02 AM
11-10-2004 07:02 AM
Re: fixed length file manipulation - is there a better way?
:)
And I also head to read and understand the attachment
Enjoy, Have FUN! H.Merijn