Skip to content

Commit a821b9c

Browse files
committed
grep -a is not necessary
1 parent 166575b commit a821b9c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

linked-collections/mk_tag_links

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dst=${@:$#:1} # last argument - target directory to create the hard links in
99
for d in "${dir[@]}" ; do if [[ ! -d "$d" ]] ; then echo Source directory "$d" does not exist - exiting ; exit 1 ; fi ; done
1010
if [[ ! -d "$dst" ]] ; then echo Target directory "$dst" does not exist - exiting ; exit 1 ; fi
1111
tmp=$(mktemp) # tmp file to collect the links so we can cleanup those that don't belong in the target dir afterwards with cleanup_links
12-
grep -arlF "com.apple.metadata:_kMDItemUserTags" "${dir[@]}" --include='*@SynoEAStream' --exclude='*.html@SynoEAStream' --exclude='*.jpg@SynoEAStream' | grep -v -- "-/" | xargs -d'\n' grep -alF "$tag" | while read i ; do
12+
grep -rlF "com.apple.metadata:_kMDItemUserTags" "${dir[@]}" --include='*@SynoEAStream' --exclude='*.html@SynoEAStream' --exclude='*.jpg@SynoEAStream' | grep -v -- "-/" | xargs -d'\n' grep -alF "$tag" | while read i ; do
1313
i=${i/@eaDir\/} ; i=${i%@SynoEAStream}
1414
# prefiltered candidate file with tag string in it is found - make sure it is a regular file (i.e. not a directory) and that the $tag is actually present in the xattrs data structure (grep -x matches the whole line)
1515
if [[ -f "$i" && -n $(tag "$i" | grep -xF "$tag") ]] ; then

linked-collections/mk_tag_links_and_dirs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dst=${@:$#:1} # last argument - target directory to create the hard links in
66
for d in "${dir[@]}" ; do if [[ ! -d "$d" ]] ; then echo Source directory "$d" does not exist - exiting ; exit 1 ; fi ; done
77
if [[ ! -d "$dst" ]] ; then echo Target directory "$dst" does not exist - exiting ; exit 1 ; fi
88
tmp=$(mktemp) # tmp file to collect the links so we can cleanup those that don't belong in the target dir afterwards with cleanup_links
9-
grep -arlF "com.apple.metadata:_kMDItemUserTags" "${dir[@]}" --include='*@SynoEAStream' --exclude='*.html@SynoEAStream' --exclude='*.jpg@SynoEAStream' | grep -v -- "-/" | while read i ; do
9+
grep -rlF "com.apple.metadata:_kMDItemUserTags" "${dir[@]}" --include='*@SynoEAStream' --exclude='*.html@SynoEAStream' --exclude='*.jpg@SynoEAStream' | grep -v -- "-/" | while read i ; do
1010
i=${i/@eaDir\/} ; i=${i%@SynoEAStream}
1111
# prefiltered candidate file with tag string(s) in it is found - make sure it is a regular file.ext (i.e. not a directory)
1212
if [[ -f $i && ${i##*/} == *.* ]] ; then

0 commit comments

Comments
 (0)