grep - get line / word
Get a word by characters
grep -o 'key3[^ ]*' <<<'key1="value1" key2="value2" key3="value3" key4="value4"'
# key3="value3"
Get value by key from string multiline or file
grep -Po 'key3=\K[^ ]+' <<<'key1=value1 key2=value2 key3=value3 key4=value4'
# value3
key3=
: key
\K
: discard matched part
[^ ]+
: get value (limit with next space)
Get line
grep "text to find" file.ext
# text to find
Get line number
grep -n "text to find" file.ext | cut -f1 -d:
# line number
Remove blank lines
# empty lines + lines with spaces
grep -v '^\s*$' file.ext
# empty lines only
grep .