summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2014-01-12 21:41:09 +0100
committerJonas Smedegaard <dr@jones.dk>2014-01-12 21:41:09 +0100
commit6e29d7184e564bc3926a1a6fefd4037099b45378 (patch)
treeac04153d39af26266dbaadedf516153a65fec66a
parenta993c7d66f66af964772f23af6b3a9e7fb814a4b (diff)
Use jshon as tidier (jq only in unstable), and split to try not loose content if parsing fails.
-rwxr-xr-xlocaltidygeojson5
1 files changed, 3 insertions, 2 deletions
diff --git a/localtidygeojson b/localtidygeojson
index 49f8c6e..5e9e3c6 100755
--- a/localtidygeojson
+++ b/localtidygeojson
@@ -16,8 +16,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-# Depends: jq moreutils
+# Depends: jshon moreutils
set -eu
-jq . "$1" | perl -0 -pe 's/ /\t/g; s/},\s*{/}, {/g; s/\[\s*([\d.,]+)\s*([\d.]+)\s*\]/[$1 $2]/g' | sponge "$1"
+jshon -SIF "$1"
+perl -0 -i -pe 's/},\s*{/}, {/g; s/\[\s*([\d.,]+)\s*([\d.]+)\s*\]/[$1 $2]/g' "$1"