"starting to write N custom columns for table"
"finished writing 1 custom column for table"
"StartBuild"
# use {x,} to match string with x+ characters | |
echo "hello world reallylongword" | grep -P "\w{6,}" -o # will match reallylongword |
# using the {x} will match whatever comes before it x amount of times | |
echo "12341234444412354444" | grep -P "4{3}" # will match 3 times '444' | |
# using the {x,y} will match a range from x to y | |
echo "12341234444344412354444" | grep -P "4{1,4}" # will match 4, 4444, 444, 4444[ |
# using the ? means that we're not matching greedily | |
echo "<p>Paragraph 1</p><p>Paragraph 2</p><p>Paragraph 3</p>" | grep -P "<p>.*?</p>" # will match <p>Paragraph 1</p>, <p>Paragraph 2</p>, <p>Paragraph 3</p> | |
# we can use the ? to match an optional character | |
echo "http:\\website.com,https:\\website2.com" | grep -P "https?.*" |
# match 0 or more times using * quantifier | |
echo "hello, how are you?" | grep -e "[a-z]*" # will match hello, how, are, you | |
# match all numbers in chunks with length of one or more with + quantifier | |
echo "47427 8381481 5813471" | grep -P "[0-9]+" | |
echo "47427 8381481 5813471" | grep -P "\d+" |
# Vowels | |
echo abcdefghijk | grep -e "[aeiou]" | |
# will find a,e,i | |
# Range | |
echo abcdefghijkAC04 | grep -e "[a-zA-D0-9]" | |
# Negation character ^ - don't match |
(?<=<).*?(?=>) |
echo "12341234444344412354444" | grep -P "4{2,4}?" -o | |
44 | |
44 | |
44 | |
44 | |
44 |
ssh -i /path/to/pem.pem user@IP 'df -h' |
# give executable permissions to script | |
chmod u+x run_monitoring | |
# run script in background and get pid for killing to stdout | |
nohup ./run_monitoring.sh > monitor_metrics.txt 2>&1 & | |
# save PID to kill | |
echo $! > save_pid.txt | |
# to kill process |