From 9ad7ed0e2f9a107c28e0897ac214513a4262dd12 Mon Sep 17 00:00:00 2001 From: Jonathan Cook Date: Thu, 26 Sep 2019 21:08:17 +0200 Subject: [PATCH] BAEL-3110 - Linux Commands - Remove All Text After X (#7867) * BAEL-3132 - Linux Commands - Loop Through Directories/Folders * BAEL-3132 - Linux Commands - Loop Through Directories/Folders - update pom description. * BAEL-3132 - Linux Commands - Loop Through Directories/Folders - Add another example using find exec. * BAEL-3132 - Linux Commands - Loop Through Directories/Folders * BAEL-3110 - Linux Commands - Remove All Text After X --- .../text/src/main/bash/remove_characters.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 linux-bash/text/src/main/bash/remove_characters.sh diff --git a/linux-bash/text/src/main/bash/remove_characters.sh b/linux-bash/text/src/main/bash/remove_characters.sh new file mode 100755 index 0000000000..a8f51468f4 --- /dev/null +++ b/linux-bash/text/src/main/bash/remove_characters.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +my_var="Hola Mundo" +echo ${my_var} + +my_filename="interesting-text-file.txt" +echo ${my_filename:0:21} + +echo ${my_filename%.*} + +complicated_filename="hello-world.tar.gz" +echo ${complicated_filename%%.*} + +echo ${my_filename/.*/} + +echo 'interesting-text-file.txt' | sed 's/.txt*//' + +echo 'interesting-text-file.txt' | cut -f1 -d"." +echo ${complicated_filename} | cut -f1 -d"."