in reply to Re^7: Sorting text files.
in thread Sorting text files.
The module Inline::Files is just used to make a self-contained program for testing purposes.
Use perl's normal open function for actual usage.
See "perldoc -f open".
#!/usr/bin/perl # http://perlmonks.org/?node_id=1147112 use strict; use warnings; my %id; open my $fhdata, '<', 'File1' or die "$! opening File1"; open my $fhorder, '<', 'File2' or die "$! opening File2"; $id{ s/;.*//r } .= $_ for sort <$fhdata>; print delete @id{ <$fhorder> }, sort values %id; close $fhdata; close $fhorder;
Where the file named "File1" contains your first file, and the file named "File2" contains your second file.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^9: Sorting text files.
by Saner (Novice) on Nov 07, 2015 at 15:06 UTC |