ci(static-checks): modify line-endings script

Fix for "(standard input)" output, based on
https://git.linaro.org/people/leonardo.sandoval/tf-a-ci-scripts.git/commit/?h=fix-dos-line-endings-patch-check&id=3a779e4a41a46068a6be6660ad4e6d90658aa557

From beginning, the script is intended to detect Windows style CRLF
and if found, fail the test. The reason behind is part of the coding
style guide, where all lines must follow the UNIX LF style.

However, when explicitly tested against a file with CRLF line endings
the script couldn't report the proper error message. It prints the
messsage "standard input" which is not ideal.

To rectify this, the script has been modified to handle this in a better
way, such that when files with CRLF line endings are encountered, they
will be printed in the logfile before failing the test.

Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
Change-Id: I0d7593bd15879f0f881134c177f1661611934ec2
diff --git a/script/static-checks/static-checks-coding-style-line-endings.sh b/script/static-checks/static-checks-coding-style-line-endings.sh
index c6b7902..77985e0 100755
--- a/script/static-checks/static-checks-coding-style-line-endings.sh
+++ b/script/static-checks/static-checks-coding-style-line-endings.sh
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 #
-# Copyright (c) 2019-2020 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2022 Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -16,8 +16,7 @@
 if [[ "$2" == "patch" ]]; then
     cd "$1"
     parent=$(git merge-base HEAD refs/remotes/origin/master | head -1)
-    git diff ${parent}..HEAD --no-ext-diff --unified=0 --exit-code -a --no-prefix | grep -E "^\+" | \
-    grep --files-with-matches $'\r$' &> "$LOG_FILE"
+    git diff ${parent}..HEAD --no-ext-diff --unified=0 --exit-code -a --no-prefix | awk '/^\+/ && /\r$/' &> "$LOG_FILE"
 else
   # For all the source and doc files
   # We only return the files that contain CRLF