You are not logged in.
Pages: 1
Can i pick someone's brains on how to modify this command ?
I have the command working ok, i just want to put in a few spaces at the beginning, think of it as padding.
ratpoison -c "info" | awk '{ print substr($3,1)}'
this prints in any given window im in through dzen2 panel as follows.
0(XTerm)
what i would like is to have a space or two in front so it prints like so with a space or two as padding.
0(XTerm)
edit: the full output of the command would be so before filtering it through awk...
(39, 136) 0(XTerm)
Last edited by dice (2021-05-11 13:22:27)
Offline
I'm no awk wizard, but what works for me on the 'uname -a' command is to prepend the argument variable with " ":
$ uname -a | awk '{print substr(" "$3,1)}'
4.19.0-16-amd64
Offline
Another way you can do it is print it with a tab before the output:
$ uname -a | awk '{print substr("\t"$3,1)}'
4.19.0-16-amd64
Last edited by andyprough (2021-05-11 14:09:52)
Offline
You can play around with printf, maybe that will give you something you can use:
uname -a | awk {'printf("%s\n", " "$3,1)'}
4.19.0-16-amd64
uname -a | awk {'printf("%s\n", "\t"$3,1)'}
4.19.0-16-amd64
Last edited by andyprough (2021-05-11 15:16:52)
Offline
I think that you are right that it is a ratpoison issue. I just checked and these commands are working on my standard DWM with dmenu when piped through dzen2, especially the forms with " " prepended. The tabbed forms "\t" are not as good as they create a space but fill it with a small box.
Offline
Pages: 1