Very cool Linux text processing tricks.

Align all text right on an 80 column width. jason@jason-Lenovo-H50-55:~/Documents$ ls -hula | sed -e :a -e ‘s/^.\{1,80\}$/ &/;ta’ total 872K drwxr-xr-x 2 jason jason 4.0K May 4 08:48 . drwxr-xr-x 23 jason jason 4.0K May 3 20:51 .. -rw-r–r– 1 jason jason 848K Apr 21 13:01 altis_insurgency_altis.pbo -rwxrwxr-x 1 jason jason 166 Apr 22 … Read more

Useful shell tips. How to search and replace characters or words with the bash shell.

Search and replace on the bash shell is very useful for various one-liner shell commands. The below example shows how to replace a # character with a * character. jason@DESKTOP-R72SPS3:/mnt/c/Users/johnc/Documents$ cat ip.c | sed ‘s/#/*/gi;’ *include <stdio.h>   int main() { printf(".");   return 0; }jason@DESKTOP-R72SPS3:/mnt/c/Users/johnc/Documents$ cat ip.c | sed ‘s/#/*/gi;’ *include <stdio.h> int main() … Read more