Created
August 26, 2017 10:09
-
-
Save songaal/44a1bc66ada65bc3dc08ae6594b45be9 to your computer and use it in GitHub Desktop.
VCard 를 CSV로 변환하는 쉘스크립트
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
#!/bin/bash | |
vcard_file=$1 | |
cat $vcard_file | while read line ; do | |
#echo $line; | |
if [ "$line" == "BEGIN:VCARD" ]; then | |
#echo $line; | |
full_name=""; | |
email=""; | |
fi | |
if [[ $line = EMAIL* ]]; then | |
if [ -z $email ]; then | |
email=${line#*:} | |
# echo EMAIL : $email; | |
fi | |
fi | |
if [[ $line = FN:* ]]; then | |
full_name=${line#*:} | |
# echo FULL_NAME : $full_name; | |
fi | |
if [ "$line" == "END:VCARD" ]; then | |
# email 이 존재한다면. | |
if [ $email ]; then | |
echo -e "$full_name\t$email" | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment