Skip to content

Instantly share code, notes, and snippets.

@ecylmz
Created February 16, 2011 19:10
Show Gist options
  • Save ecylmz/829938 to your computer and use it in GitHub Desktop.
Save ecylmz/829938 to your computer and use it in GitHub Desktop.
#!/usr/bin/awk -f
# aşağıdaki biçimde gelen bir csv dosyadan lwat'a yüklenebilecek
# biçimde bir csv dosya oluştur:
#
# öğrenci no,ad soyad
#
# orijinal hali https://gist.github.com/3d690cbdfd6055b8a05b
BEGIN {
FS = ","
print "name,username,password"
}
{
pass = $1
if (split($2, a, / /) > 2) {
user = "\"" a[2] "" a[3]
first = a[1] " " a[2]
last = a[3]
} else {
user = a[1] "" a[2]
first = a[1]
last= a[2]
}
gsub(/ı/, "i", user)
gsub(/ğ/, "g", user)
gsub(/ü/, "u", user)
gsub(/ş/, "s", user)
gsub(/ç/, "c", user)
gsub(/ö/, "o", user)
printf("%s %s,%s,%s\n", first, last, user, pass)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment