Skip to content

Instantly share code, notes, and snippets.

@abcsharp
Created March 29, 2012 17:53
Show Gist options
  • Save abcsharp/2240829 to your computer and use it in GitHub Desktop.
Save abcsharp/2240829 to your computer and use it in GitHub Desktop.
渡されたテキストファイルから重複している行を削除し別のファイルに出力する
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