File tree Expand file tree Collapse file tree 3 files changed +46
-30
lines changed Expand file tree Collapse file tree 3 files changed +46
-30
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ # ------------------------------------
3
+ # Escapes '<' and '>' symbols for XML.
4
+ #
5
+ # For example:
6
+ #
7
+ # $ ./escape_xml.sh '<Master>'
8
+ # <Master>
9
+ # ------------------------------------
10
+ echo " $1 " | \
11
+ sed ' s/>/\>/g' | \
12
+ sed ' s/</\</g'
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # ----------------------------------------------
3
+ # Find all references to a spreadsheet alias.
4
+ # Third positional alias argument is optional.
5
+ # Supports escaping '<' and '>' symbols for XML.
6
+ # ----------------------------------------------
7
+ if [ -z " $1 " ] || [ -z " $2 " ]; then
8
+ echo " Usage: findrefs.bash <document> <spreadsheet> [alias]"
9
+ exit 1
10
+ fi
11
+
12
+ # https://unix.stackexchange.com/a/635518
13
+ escape_xml=" ${0%/* } /escape_xml.sh"
14
+
15
+ freecad_documents=` find . -type f -name " *.FCStd" `
16
+ document=$( $escape_xml $1 )
17
+ spreadsheet=$( $escape_xml $2 )
18
+ alias=$3
19
+
20
+ SAVEIFS=$IFS
21
+ IFS=$( echo -en " \n\b" )
22
+ for freecad_document in $freecad_documents
23
+ do
24
+ result=$( zipgrep " $document #$spreadsheet .$alias " " $freecad_document " )
25
+
26
+ if [ ! -z " $result " ]; then
27
+ printf " $freecad_document \n"
28
+ if [ ! -z " $result " ]; then
29
+ echo $result | xargs | grep --color=auto $document #$spreadsheet .$alias
30
+ fi
31
+ printf " \n"
32
+ fi
33
+ done
34
+ IFS=$SAVEIFS
You can’t perform that action at this time.
0 commit comments