sed join lines together

sed ‘:a;/0$/{N;s/\n//;ba}’ In a loop (branch ba to label :a), if the current line ends in 0 (/0$/) append next line (N) and remove inner newline (s/\n//). awk: awk ‘{while(/0$/) { getline a; $0=$0 a; sub(/\n/,_) }; print}’ Perl: perl -pe ‘$_.=<>,s/\n// while /0$/’ bash: while read line; do if [ ${line: -1:1} != “0” … Read more

What does \1 in sed do?

Here’s a simple example: $ echo ‘abcabcabc’ | sed ‘s/\(ab\)c/\1/’ ababcabc $ echo ‘abcabcabc’ | sed ‘s/\(ab\)c/\1/g’ ababab $ echo ‘abcabcabc’ | sed ‘s/\(ab\)\(c\)/\1d\2/g’ abdcabdcabdc In the first command, only the first match is affected. In the second command, every match is affected. In both cases, the \1 refers to the characters captured by the … Read more

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