Created
March 1, 2011 20:23
-
-
Save ecylmz/849823 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
#!/usr/bin/awk -f | |
# input format : student number, full name, e-mail | |
# output format : full name, user name, student number | |
# example : | |
# input : 09060286,"emre can yılmaz","[email protected]" | |
# output : "emre can yılmaz","canyilmaz",09060286 | |
# usage : | |
# | |
# $ chmod +x csv-render | |
# ./csv-render foo.csv | |
BEGIN { | |
FS = "," | |
} | |
{ | |
number = $1 | |
if (split($2, a, / /) > 2) { | |
user = "\"" a[2] "" a[3] # csv'den gelen veride, ad soyad kısmınının " " arasına yazıldığı varsayılmıştır. | |
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, number) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment