Created
March 29, 2012 17:53
-
-
Save abcsharp/2240829 to your computer and use it in GitHub Desktop.
渡されたテキストファイルから重複している行を削除し別のファイルに出力する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Script | |
open System.IO | |
[<EntryPoint>] | |
let main (args : string[]) = | |
if args.Length = 2 then | |
let keys = | |
File.ReadAllLines(args.[0]) | |
|> Array.sort | |
|> Array.fold | |
(fun stat s -> | |
if Array.exists ((<>) s) stat then | |
Array.append stat [|s|] | |
else | |
stat) | |
Array.empty<string> | |
File.WriteAllLines(args.[1], keys, System.Text.Encoding.Default) | |
0 | |
else | |
1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment