Skip to content

Instantly share code, notes, and snippets.

@llimllib

llimllib/sort.go Secret

Last active December 25, 2015 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save llimllib/e55c0614d3859bc51d19 to your computer and use it in GitHub Desktop.
Save llimllib/e55c0614d3859bc51d19 to your computer and use it in GitHub Desktop.
package main
import ( "io/ioutil"; "os"; "strings"; "sort" )
func main() {
content, _ := ioutil.ReadFile(os.Args[1])
lines := strings.Split(strings.TrimSpace(string(content)), "\n")
sort.Strings(lines)
ioutil.WriteFile(os.Args[2], []byte(strings.Join(lines, "\n")), 0666)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment