Skip to content

Instantly share code, notes, and snippets.

@songaal
Created August 26, 2017 10:09
Show Gist options
  • Save songaal/44a1bc66ada65bc3dc08ae6594b45be9 to your computer and use it in GitHub Desktop.
Save songaal/44a1bc66ada65bc3dc08ae6594b45be9 to your computer and use it in GitHub Desktop.
VCard 를 CSV로 변환하는 쉘스크립트
#!/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