]> git.plutz.net Git - lobster/commitdiff
be agnostic towards trailing newlines in vcard files
authorPaul Hänsch <paul@plutz.net>
Wed, 22 Jan 2020 13:48:02 +0000 (14:48 +0100)
committerPaul Hänsch <paul@plutz.net>
Wed, 22 Jan 2020 13:48:02 +0000 (14:48 +0100)
cards/list.sh

index ce8c1ab50929901269d365c374b7c7799a317f31..33ca99110ebdb4cf37ee81e9d42f00b816f3d146 100755 (executable)
@@ -113,8 +113,7 @@ filter_cards(){
   done
 
   for cardfile in "${_DATA}"/vcard/*.vcf; do
-    printf '%s\n' "$cardfile"
-    cat "$cardfile"
+    printf '%s\n' "$cardfile" "$(grep -vxE " *${CR}?" "$cardfile")"
   done \
   | sed -En ':X; /\nEND;?:VCARD\r?$/!{ N; bX; }; h; s;\n.*$;;; x; s;^[^\n]+\n;;;
              '"$upcase""$fex"