This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Exit on error | |
set -e | |
# Exit if variable was not set | |
set -u | |
# Exit when command in pipe fails | |
set -o pipefail | |
# Print every command executed with variable interpolation | |
set -x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Print lines from line which match pattern to end of file | |
pattern="" | |
sed -n "/$pattern/,$ p" file.txt | |
# Example | |
pattern="mnop" | |
str="$(echo -e "abcd\nefgh\nijkl\nmnop\nqrst\nuvw\nxyz" | sed -n "/$pattern/,$ p")" | |
echo $str | |
# Remove lines before line LINE including LINE |
NewerOlder