coreboot/util/scripts/xml_converter.sh
Stefan Reinauer 1b419a2c5d chromeos: add internal scripts to handle 3rdparty files
We're using these scripts to clean up some of the files in 3rdparty.
Moving 3rdparty out of the coreboot repository and into the private
overlays would have required to duplicate these scripts in every
overlay. Instead, move them to coreboot's util/ directory.

BUG=none
TEST=none needed.
BRANCH=none

Change-Id: Ia914a2e23b97381c0490a8a03441caf8d2a0532d
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/47685
Reviewed-by: Gabe Black <gabeblack@chromium.org>
2013-04-12 13:18:10 -07:00

21 lines
510 B
Bash
Executable file

#!/bin/bash
# This script is a filter processing XML files.
#
# Processing is as follows:
#
# - get rid of DOS line ends;
# - place each opening tag on a separate line, with no leading spaces and the
# first attribute definition following the tag name;
# - place each attribute definition on a separate line, starting with a space;
#
# usage:
# xml_converter.sh '<unformatted-xml-file>' > '<formatted-xml-file>'
#
cat $1 | sed 's/></>\n</g;
s/\r$//;
s/^[\t ]\+//;
s/" /"\n /g;
s/^/ /;
s/^ </</;
/^\s*$/d;'