Sunday, January 24, 2021
Thursday, January 21, 2021
Shift+{Left|Right}_Arrow pressed generates C, D in bash
This situation made me stuck for a while, especially in comparison of two equal Linux systems. One Linux generates ;2D while another generates simply short D ( :-) ) when shift-left_arrow combination was pressed (it actually expected to be Esc[1;2D , but the shell ate first two symbols (Esc[ is the control sequence introducer, see console_codes (4))
It's very difficult to answer shortly what was going on because where were a lot of Linux players (program layers, terminal types etc.) in the chain between keys pressed and actually displayed on the terminal window. One of the widespread "players" is a readline library. I'm totally unable to explain that, but simple creation of the empty .inputrc file in the home directory solved the issue.
Good Luck !
Wednesday, January 6, 2021
sed tricks
1. According to http://sed.sourceforge.net/sedfaq5.html#s5.10 you cannot directly process the EOL symbol (\n) using simple sed commands. You should read next line into the processing buffer and only AFTER THAT make necessary actions. For example, to change EOL to comma, use the following :
grep some_info filename_containing_info | awk '{print $6}' | sed ":a;N;s/\n/\,/;ta"