grep without string

Either of the these will do: grep -v “def” input_file | grep “abc” or grep “abc” input_file | grep -v “def” The following will also preserve coloring if you only want to see the output on stdout: grep –color=always “abc” input_file | grep -v “def” The -v option (stands for “invert match”) tells grep to … Read more

How can I grep complex strings in variables?

if echo “$long_str” | grep -q “$shrt_str”;then echo “found” fi or echo “$long_str” | grep -q “$shrt_str” && echo “found” || echo “not found” But since you are using bash shell, then use shell internals. No need to call external commands shrt_str=”guide” case “$long_str” in *”$shrt_str”* ) echo “Found”;; * ) echo “Not found”;; esac

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)