cool sed/grep magic to convert output to csv format

I generallly keep doing this a lot, so thought will share with you. Lets assume we are capturing free ouput every min/hour/or whatever. The output looks like this:

Time: Mon Jan 21 23:59:10 AEDT 2019
——————-

total        used        free      shared  buff/cache   available
Mem:          32014        8656        1735        1697       21621       21308
Swap: 51195 75 51120

then we can use some grep and sed to convert this to something like this:

Mon Jan 21 23:59:10 AEDT 2019,32014,8656,1735,1697,21621,21308

This is the code that I used for this:

zgrep -E '^(Time|Mem):' free.20190121.gz |sed -E '/Mem/ s/\s+/,/g'|sed -E 's/^(Time|Mem):\s*//' |sed   ':a;$!N;s/\n//;P'
Explanation:

use zgrep to get the line starting with time or mem
use sed to convert multiple spaces to single space
use sed again to get only the line containing Memory or time
use sed the last time to merge the 2 lines

Gnome with i3 on Fedora 29

I have been thinking of doing this for long time, finally I managed to get this working. Here is what you need to do to get i3 with all other gnome services running.

First we will create 2 files, this is actually all you need. In these ones, I copied the original gnome files and just change gnome-shell to i3 to replace my window manager.

11:15:43=>[~]> cat /usr/share/gnome-session/sessions/gnome-i3.session
[GNOME Session]
Name=GNOME + i3
# RequiredComponents=gnome-flashback-init;gnome-flashback;i3;gnome-settings-daemon;
RequiredComponents=i3;org.gnome.SettingsDaemon.A11ySettings;org.gnome.SettingsDaemon.Clipboard;org.gnome.SettingsDaemon.Color;org.gnome.SettingsDaemon.Datetime;org.gnome.SettingsDaemon.Housekeeping;org.gnome.SettingsDaemon.Keyboard;org.gnome.SettingsDaemon.MediaKeys;org.gnome.SettingsDaemon.Mouse;org.gnome.SettingsDaemon.Power;org.gnome.SettingsDaemon.PrintNotifications;org.gnome.SettingsDaemon.Rfkill;org.gnome.SettingsDaemon.ScreensaverProxy;org.gnome.SettingsDaemon.Sharing;org.gnome.SettingsDaemon.Smartcard;org.gnome.SettingsDaemon.Sound;org.gnome.SettingsDaemon.Wacom;org.gnome.SettingsDaemon.XSettings;
11:15:47=>[~]> cat /usr/share/xsessions/gnome-i3.desktop
[Desktop Entry]
Name=GNOME i3
Comment=This session logs you into GNOME + i3
Exec=env GNOME_SHELL_SESSION_MODE=gnome-i3 gnome-session –session gnome-i3
TryExec=gnome-session
Type=Application
DesktopNames=GNOME-Classic;GNOME;

Once, you have created these files, you can restart gdm and then select “Gnome i3” to login to your brand new session of gnome with i3.

bash function for rpm whatprovides

Sometimes some simple one-liner function can save you a lot of time, like-

wps ()
{
    rpm -q --whatprovides $(which $1 )
}   # ----------  end of function wps  ----------