Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #204221 > unrolled thread

Taming the "lsblk" command

Started byRichard Owlett <rowlett@cloud85.net>
First post2019-01-08 22:00 +0100
Last post2019-01-10 13:50 +0100
Articles 20 — 11 participants

Back to article view | Back to linux.debian.user


Contents

  Taming the "lsblk" command Richard Owlett <rowlett@cloud85.net> - 2019-01-08 22:00 +0100
    Re: Taming the "lsblk" command Reco <recoverym4n@enotuniq.net> - 2019-01-08 22:20 +0100
    Re: Taming the "lsblk" command Jude DaShiell <jdashiel@panix.com> - 2019-01-09 06:10 +0100
      Re: Taming the "lsblk" command Richard Owlett <rowlett@cloud85.net> - 2019-01-09 07:30 +0100
      Re: Taming the "lsblk" command Felix Miata <mrmazda@earthlink.net> - 2019-01-09 07:50 +0100
        Re: Taming the "lsblk" command Bob McGowan <ramjr0915@gmail.com> - 2019-01-09 08:00 +0100
        Re: Taming the "lsblk" command Jude DaShiell <jdashiel@panix.com> - 2019-01-09 12:50 +0100
          Re: Taming the "lsblk" command Felix Miata <mrmazda@earthlink.net> - 2019-01-09 14:00 +0100
            Re: Taming the "lsblk" command David Wright <deblis@lionunicorn.co.uk> - 2019-01-09 15:30 +0100
      Re: Taming the "lsblk" command Richard Hector <richard@walnut.gen.nz> - 2019-01-09 09:10 +0100
        Re: Taming the "lsblk" command rhkramer@gmail.com - 2019-01-09 14:00 +0100
          Re: Taming the "lsblk" command Curt <curty@free.fr> - 2019-01-09 15:00 +0100
            Re: Taming the "lsblk" command David Wright <deblis@lionunicorn.co.uk> - 2019-01-09 15:20 +0100
              Re: Taming the "lsblk" command Richard Owlett <rowlett@cloud85.net> - 2019-01-09 16:40 +0100
                Re: Taming the "lsblk" command Curt <curty@free.fr> - 2019-01-09 18:00 +0100
              Re: Taming the "lsblk" command mick crane <mick.crane@gmail.com> - 2019-01-09 17:20 +0100
                Re: Taming the "lsblk" command David Wright <deblis@lionunicorn.co.uk> - 2019-01-09 20:10 +0100
                  Re: Taming the "lsblk" command Michael Stone <mstone@debian.org> - 2019-01-09 22:40 +0100
                    Re: Taming the "lsblk" command David Wright <deblis@lionunicorn.co.uk> - 2019-01-10 02:00 +0100
                      Re: Taming the "lsblk" command Michael Stone <mstone@debian.org> - 2019-01-10 13:50 +0100

#204221 — Taming the "lsblk" command

FromRichard Owlett <rowlett@cloud85.net>
Date2019-01-08 22:00 +0100
SubjectTaming the "lsblk" command
Message-ID<xe6DD-1fQ-13@gated-at.bofh.it>
When I do
  >lsblk -o name,label
I get a nice graphical result in _STRICT_  *ALPHA_NUMERIC* order.

However when I do > lsblk -l -o name,label
I get > sdc14 good-fvwm
  > sdc15 tst_mysql
  > sde
  > sde1  debian-2-go
  > sr0
  > sdc16 tst_mariadb
  > sdc17 dummy
  > sdc18 target

I wish to feed the output of "lsblk -l -o name,label" to a script which 
*DEPENDS* on input being in strict alpha-numeric order.

How?
TIA

[toc] | [next] | [standalone]


#204222

FromReco <recoverym4n@enotuniq.net>
Date2019-01-08 22:20 +0100
Message-ID<xe6WZ-1BX-1@gated-at.bofh.it>
In reply to#204221
	Hi.

On Tue, Jan 08, 2019 at 02:56:39PM -0600, Richard Owlett wrote:
> I wish to feed the output of "lsblk -l -o name,label" to a script which *DEPENDS* on input being in strict alpha-numeric order.
> 
> How?

lsblk(8):

lsblk -l -x name -o name,label

Reco

[toc] | [prev] | [next] | [standalone]


#204224

FromJude DaShiell <jdashiel@panix.com>
Date2019-01-09 06:10 +0100
Message-ID<xeehP-6rN-5@gated-at.bofh.it>
In reply to#204221
lsblk -l -o name,label | sort | script
On Tue, 8 Jan 2019, Richard Owlett
wrote:

> Date: Tue, 8 Jan 2019 15:56:39
> From: Richard Owlett <rowlett@cloud85.net>
> To: debian-user <debian-user@lists.debian.org>
> Subject: Taming the "lsblk" command
> Resent-Date: Tue,  8 Jan 2019 20:57:05 +0000 (UTC)
> Resent-From: debian-user@lists.debian.org
>
> When I do
>  >lsblk -o name,label
> I get a nice graphical result in _STRICT_  *ALPHA_NUMERIC* order.
>
> However when I do > lsblk -l -o name,label
> I get > sdc14 good-fvwm
>  > sdc15 tst_mysql
>  > sde
>  > sde1  debian-2-go
>  > sr0
>  > sdc16 tst_mariadb
>  > sdc17 dummy
>  > sdc18 target
>
> I wish to feed the output of "lsblk -l -o name,label" to a script which
> *DEPENDS* on input being in strict alpha-numeric order.
>
> How?
> TIA
>
>
>
>
>

-- 

[toc] | [prev] | [next] | [standalone]


#204225

FromRichard Owlett <rowlett@cloud85.net>
Date2019-01-09 07:30 +0100
Message-ID<xefxg-7aE-3@gated-at.bofh.it>
In reply to#204224
DUH ;/
I was so focused on lsblk demonstrating with its graphical output that 
it COULD do what I wanted that I didn't think about an external sort,
Thank you



On 01/08/2019 11:04 PM, Jude DaShiell wrote:
> lsblk -l -o name,label | sort | script
> On Tue, 8 Jan 2019, Richard Owlett
> wrote:
> 
>> Date: Tue, 8 Jan 2019 15:56:39
>> From: Richard Owlett <rowlett@cloud85.net>
>> To: debian-user <debian-user@lists.debian.org>
>> Subject: Taming the "lsblk" command
>> Resent-Date: Tue,  8 Jan 2019 20:57:05 +0000 (UTC)
>> Resent-From: debian-user@lists.debian.org
>>
>> When I do
>>   >lsblk -o name,label
>> I get a nice graphical result in _STRICT_  *ALPHA_NUMERIC* order.
>>
>> However when I do > lsblk -l -o name,label
>> I get > sdc14 good-fvwm
>>   > sdc15 tst_mysql
>>   > sde
>>   > sde1  debian-2-go
>>   > sr0
>>   > sdc16 tst_mariadb
>>   > sdc17 dummy
>>   > sdc18 target
>>
>> I wish to feed the output of "lsblk -l -o name,label" to a script which
>> *DEPENDS* on input being in strict alpha-numeric order.
>>
>> How?
>> TIA
>>
>>
>>
>>
>>
> 

[toc] | [prev] | [next] | [standalone]


#204226

FromFelix Miata <mrmazda@earthlink.net>
Date2019-01-09 07:50 +0100
Message-ID<xefQB-7ht-3@gated-at.bofh.it>
In reply to#204224
Jude DaShiell composed on 2019-01-09 00:04 (UTC-0500):

> lsblk -l -o name,label | sort | script

I tried exactly that on Buster multiple times, and always get the following:

root@gb250:~# NAME  LABEL
bash: NAME: command not found
root@gb250:~# sda
bash: sda: command not found
root@gb250:~# sda10 k25p10deb10
bash: sda10: command not found
root@gb250:~# sda11 k25p11deb10fat
bash: sda11: command not found
root@gb250:~# sda12 k25p12Ubionic
bash: sda12: command not found
root@gb250:~# sda13
bash: sda13: command not found
root@gb250:~# sda14
bash: sda14: command not found
root@gb250:~# sda15
bash: sda15: command not found
root@gb250:~# sda16
bash: sda16: command not found
root@gb250:~# sda1  K25P01ESP
bash: sda1: command not found
root@gb250:~# sda2  k25p02swap
bash: sda2: command not found
root@gb250:~# sda3  k25p03res
bash: sda3: command not found
root@gb250:~# sda4  k25p04usrlcl
bash: sda4: command not found
root@gb250:~# sda5  k25p05home
bash: sda5: command not found
root@gb250:~# sda6  k25p06pub
bash: sda6: command not found
root@gb250:~# sda7  k25p07stw
bash: sda7: command not found
root@gb250:~# sda8  k25p08s150
bash: sda8: command not found
root@gb250:~# sda9  k25p09s151
bash: sda9: command not found
root@gb250:~# sr0
bash: sr0: command not found
root@gb250:~# exit
-- 
Evolution as taught in public schools is religion, not science.

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata  ***  http://fm.no-ip.com/

[toc] | [prev] | [next] | [standalone]


#204227

FromBob McGowan <ramjr0915@gmail.com>
Date2019-01-09 08:00 +0100
Message-ID<xeg0i-7l8-9@gated-at.bofh.it>
In reply to#204226
On 1/8/19 10:47 PM, Felix Miata wrote:
> Jude DaShiell composed on 2019-01-09 00:04 (UTC-0500):
>
>> lsblk -l -o name,label | sort | script
> I tried exactly that on Buster multiple times, and always get the following:
>
> root@gb250:~# NAME  LABEL
> bash: NAME: command not found
> root@gb250:~# sda
> bash: sda: command not found
> root@gb250:~# sda10 k25p10deb10
> bash: sda10: command not found
> root@gb250:~# sda11 k25p11deb10fat
> bash: sda11: command not found
> root@gb250:~# sda12 k25p12Ubionic
> bash: sda12: command not found
> root@gb250:~# sda13
> bash: sda13: command not found
> root@gb250:~# sda14
> bash: sda14: command not found
> root@gb250:~# sda15
> bash: sda15: command not found
> root@gb250:~# sda16
> bash: sda16: command not found
> root@gb250:~# sda1  K25P01ESP
> bash: sda1: command not found
> root@gb250:~# sda2  k25p02swap
> bash: sda2: command not found
> root@gb250:~# sda3  k25p03res
> bash: sda3: command not found
> root@gb250:~# sda4  k25p04usrlcl
> bash: sda4: command not found
> root@gb250:~# sda5  k25p05home
> bash: sda5: command not found
> root@gb250:~# sda6  k25p06pub
> bash: sda6: command not found
> root@gb250:~# sda7  k25p07stw
> bash: sda7: command not found
> root@gb250:~# sda8  k25p08s150
> bash: sda8: command not found
> root@gb250:~# sda9  k25p09s151
> bash: sda9: command not found
> root@gb250:~# sr0
> bash: sr0: command not found
> root@gb250:~# exit

What was the content of the script you piped to?  Its design would 
possibly explain this.

Bob

[toc] | [prev] | [next] | [standalone]


#204232

FromJude DaShiell <jdashiel@panix.com>
Date2019-01-09 12:50 +0100
Message-ID<xekwV-1FM-9@gated-at.bofh.it>
In reply to#204226
On Wed, 9 Jan 2019, Felix Miata wrote:

> Date: Wed, 9 Jan 2019 01:47:24
> From: Felix Miata <mrmazda@earthlink.net>
> To: debian-user@lists.debian.org
> Subject: Re: Taming the "lsblk" command
> Resent-Date: Wed,  9 Jan 2019 06:47:41 +0000 (UTC)
> Resent-From: debian-user@lists.debian.org
>
> Jude DaShiell composed on 2019-01-09 00:04 (UTC-0500):
>
> > lsblk -l -o name,label | sort | script
>
> I tried exactly that on Buster multiple times, and always get the following:
>
> root@gb250:~# NAME  LABEL
> bash: NAME: command not found
> root@gb250:~# sda
> bash: sda: command not found
> root@gb250:~# sda10 k25p10deb10
> bash: sda10: command not found
> root@gb250:~# sda11 k25p11deb10fat
> bash: sda11: command not found
> root@gb250:~# sda12 k25p12Ubionic
> bash: sda12: command not found
> root@gb250:~# sda13
> bash: sda13: command not found
> root@gb250:~# sda14
> bash: sda14: command not found
> root@gb250:~# sda15
> bash: sda15: command not found
> root@gb250:~# sda16
> bash: sda16: command not found
> root@gb250:~# sda1  K25P01ESP
> bash: sda1: command not found
> root@gb250:~# sda2  k25p02swap
> bash: sda2: command not found
> root@gb250:~# sda3  k25p03res
> bash: sda3: command not found
> root@gb250:~# sda4  k25p04usrlcl
> bash: sda4: command not found
> root@gb250:~# sda5  k25p05home
> bash: sda5: command not found
> root@gb250:~# sda6  k25p06pub
> bash: sda6: command not found
> root@gb250:~# sda7  k25p07stw
> bash: sda7: command not found
> root@gb250:~# sda8  k25p08s150
> bash: sda8: command not found
> root@gb250:~# sda9  k25p09s151
> bash: sda9: command not found
> root@gb250:~# sr0
> bash: sr0: command not found
> root@gb250:~# exit
>
That can happen if bash doesn't find sort in its default binary
directory.  Could be pointing bash directly at sort will clear the
command not found error out of the output.

-- 

[toc] | [prev] | [next] | [standalone]


#204234

FromFelix Miata <mrmazda@earthlink.net>
Date2019-01-09 14:00 +0100
Message-ID<xelCG-2i4-19@gated-at.bofh.it>
In reply to#204232
Jude DaShiell composed on 2019-01-09 06:48 (UTC-0500):

> Felix Miata wrote:

>> Jude DaShiell composed on 2019-01-09 00:04 (UTC-0500):

>>> lsblk -l -o name,label | sort | script

>> I tried exactly that on Buster multiple times, and always get the following:

>> root@gb250:~# NAME  LABEL
>> bash: NAME: command not found
>> root@gb250:~# sda
>> bash: sda: command not found
>> root@gb250:~# sda10 k25p10deb10
>> bash: sda10: command not found
>> root@gb250:~# sda11 k25p11deb10fat
>> bash: sda11: command not found
...
>> root@gb250:~# sda8  k25p08s150
>> bash: sda8: command not found
>> root@gb250:~# sda9  k25p09s151
>> bash: sda9: command not found
>> root@gb250:~# sr0
>> bash: sr0: command not found
>> root@gb250:~# exit

> That can happen if bash doesn't find sort in its default binary
> directory.  Could be pointing bash directly at sort will clear the
> command not found error out of the output.

# cat /etc/debian_version
buster/sid
# which sort
/usr/bin/sort
# which script
/usr/bin/script

Same result from:

	lsblk -l -o name,label | /usr/bin/sort | /usr/bin/script
-- 
Evolution as taught in public schools is religion, not science.

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata  ***  http://fm.no-ip.com/

[toc] | [prev] | [next] | [standalone]


#204242

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2019-01-09 15:30 +0100
Message-ID<xen1L-3hu-1@gated-at.bofh.it>
In reply to#204234
On Wed 09 Jan 2019 at 07:51:31 (-0500), Felix Miata wrote:
> Jude DaShiell composed on 2019-01-09 06:48 (UTC-0500):
> 
> > Felix Miata wrote:
> 
> >> Jude DaShiell composed on 2019-01-09 00:04 (UTC-0500):
> 
> >>> lsblk -l -o name,label | sort | script
> 
> >> I tried exactly that on Buster multiple times, and always get the following:
> 
> >> root@gb250:~# NAME  LABEL
> >> bash: NAME: command not found
> >> root@gb250:~# sda
> >> bash: sda: command not found
> >> root@gb250:~# sda10 k25p10deb10
> >> bash: sda10: command not found
> >> root@gb250:~# sda11 k25p11deb10fat
> >> bash: sda11: command not found
> ...
> >> root@gb250:~# sda8  k25p08s150
> >> bash: sda8: command not found
> >> root@gb250:~# sda9  k25p09s151
> >> bash: sda9: command not found
> >> root@gb250:~# sr0
> >> bash: sr0: command not found
> >> root@gb250:~# exit
> 
> > That can happen if bash doesn't find sort in its default binary
> > directory.  Could be pointing bash directly at sort will clear the
> > command not found error out of the output.
> 
> # cat /etc/debian_version
> buster/sid
> # which sort
> /usr/bin/sort
> # which script
> /usr/bin/script
> 
> Same result from:
> 
> 	lsblk -l -o name,label | /usr/bin/sort | /usr/bin/script

You've attempted to run a shell using the output of lsblk as a series
of commands for it to execute.

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#204228

FromRichard Hector <richard@walnut.gen.nz>
Date2019-01-09 09:10 +0100
Message-ID<xeh62-8bp-5@gated-at.bofh.it>
In reply to#204224

[Multipart message — attachments visible in raw view] — view raw

On 9/01/19 6:04 PM, Jude DaShiell wrote:
> lsblk -l -o name,label | sort | script

lsblk -ln -o name,label |sort | <script>

perhaps?

-n omits the headers, and you probably don't want to pipe into literally
'script' (typescript) :-)

Richard


[toc] | [prev] | [next] | [standalone]


#204233

Fromrhkramer@gmail.com
Date2019-01-09 14:00 +0100
Message-ID<xelCG-2i4-15@gated-at.bofh.it>
In reply to#204228
On Wednesday, January 09, 2019 03:01:42 AM Richard Hector wrote:
> On 9/01/19 6:04 PM, Jude DaShiell wrote:
> > lsblk -l -o name,label | sort | script
> 
> lsblk -ln -o name,label |sort | <script>

I'm not the OP, but I very much like the way you put script in angle brackets
to show that is a parameter (mcow) and not a literal value!!


> 
> perhaps?
> 
> -n omits the headers, and you probably don't want to pipe into literally
> 'script' (typescript) :-)
> 
> Richard

[toc] | [prev] | [next] | [standalone]


#204236

FromCurt <curty@free.fr>
Date2019-01-09 15:00 +0100
Message-ID<xemyJ-2RP-7@gated-at.bofh.it>
In reply to#204233
On 2019-01-09, rhkramer@gmail.com <rhkramer@gmail.com> wrote:
> On Wednesday, January 09, 2019 03:01:42 AM Richard Hector wrote:
>> On 9/01/19 6:04 PM, Jude DaShiell wrote:
>> > lsblk -l -o name,label | sort | script
>> 
>> lsblk -ln -o name,label |sort | <script>
>
> I'm not the OP, but I very much like the way you put script in angle brackets
> to show that is a parameter (mcow) and not a literal value!!

I'll see that affection for mundane angle brackets and raise you the
annoyance of not having received the vaguest clue as to what might be
found literally inside them (the pertinent part, at the very least).

[toc] | [prev] | [next] | [standalone]


#204239

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2019-01-09 15:20 +0100
Message-ID<xemS6-3e7-3@gated-at.bofh.it>
In reply to#204236
On Wed 09 Jan 2019 at 13:54:45 (+0000), Curt wrote:
> On 2019-01-09, rhkramer@gmail.com <rhkramer@gmail.com> wrote:
> > On Wednesday, January 09, 2019 03:01:42 AM Richard Hector wrote:
> >> On 9/01/19 6:04 PM, Jude DaShiell wrote:
> >> > lsblk -l -o name,label | sort | script
> >> 
> >> lsblk -ln -o name,label |sort | <script>
> >
> > I'm not the OP, but I very much like the way you put script in angle brackets
> > to show that is a parameter (mcow) and not a literal value!!
> 
> I'll see that affection for mundane angle brackets and raise you the
> annoyance of not having received the vaguest clue as to what might be
> found literally inside them (the pertinent part, at the very least).

I don't think the OP told us what the script was, but just that they
want to pipe the output into "a script". Using angle brackets from the
start (or knowing that script itself is a program) would have avoided
the mess in the other subthread.

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#204247

FromRichard Owlett <rowlett@cloud85.net>
Date2019-01-09 16:40 +0100
Message-ID<xeo7w-3VN-27@gated-at.bofh.it>
In reply to#204239
On 01/09/2019 08:14 AM, David Wright wrote:
> On Wed 09 Jan 2019 at 13:54:45 (+0000), Curt wrote:
>> On 2019-01-09, rhkramer@gmail.com <rhkramer@gmail.com> wrote:
>>> On Wednesday, January 09, 2019 03:01:42 AM Richard Hector wrote:
>>>> On 9/01/19 6:04 PM, Jude DaShiell wrote:
>>>>> lsblk -l -o name,label | sort | script
>>>>
>>>> lsblk -ln -o name,label |sort | <script>
>>>
>>> I'm not the OP, but I very much like the way you put script in angle brackets
>>> to show that is a parameter (mcow) and not a literal value!!
>>
>> I'll see that affection for mundane angle brackets and raise you the
>> annoyance of not having received the vaguest clue as to what might be
>> found literally inside them (the pertinent part, at the very least).
> 
> I don't think the OP told us what the script was,

'Cause ain't written yet ;)
I needed to know if the data was available in a suitable format.
As this should be in a script initialization section, I believe 
redirection is more appropriate than pipes.

One line of my script will be:
   > lsblk -l -o name,label | sort > /home/richard/mydata.txt

> but just that they
> want to pipe the output into "a script". Using angle brackets from the
> start (or knowing that script itself is a program) would have avoided
> the mess in the other subthread.

I had no problem interpreting Jude's post.
My personal convention would have been to write it as
"lsblk -l -o name,label | sort | myscript".

BUT. I read Jude's and Reco's posts at midnight.
Reco's answer of "lsblk -l -x name -o name,label" was better.
I just tried Jude's as I read it after Jude's.
I should reply only when really awake ;/

[toc] | [prev] | [next] | [standalone]


#204255

FromCurt <curty@free.fr>
Date2019-01-09 18:00 +0100
Message-ID<xepmW-4Ck-1@gated-at.bofh.it>
In reply to#204247
On 2019-01-09, Richard Owlett <rowlett@cloud85.net> wrote:
> On 01/09/2019 08:14 AM, David Wright wrote:
>> On Wed 09 Jan 2019 at 13:54:45 (+0000), Curt wrote:
>>> On 2019-01-09, rhkramer@gmail.com <rhkramer@gmail.com> wrote:
>>>> On Wednesday, January 09, 2019 03:01:42 AM Richard Hector wrote:
>>>>> On 9/01/19 6:04 PM, Jude DaShiell wrote:
>>>>>> lsblk -l -o name,label | sort | script
>>>>>
>>>>> lsblk -ln -o name,label |sort | <script>
>>>>
>>>> I'm not the OP, but I very much like the way you put script in angle brackets
>>>> to show that is a parameter (mcow) and not a literal value!!
>>>
>>> I'll see that affection for mundane angle brackets and raise you the
>>> annoyance of not having received the vaguest clue as to what might be
>>> found literally inside them (the pertinent part, at the very least).
>> 
>> I don't think the OP told us what the script was,
>
> 'Cause ain't written yet ;)
> I needed to know if the data was available in a suitable format.
> As this should be in a script initialization section, I believe 
> redirection is more appropriate than pipes.
>
> One line of my script will be:
>    > lsblk -l -o name,label | sort > /home/richard/mydata.txt
>
>> but just that they
>> want to pipe the output into "a script". Using angle brackets from the
>> start (or knowing that script itself is a program) would have avoided
>> the mess in the other subthread.
>
> I had no problem interpreting Jude's post.
> My personal convention would have been to write it as
> "lsblk -l -o name,label | sort | myscript".
>
> BUT. I read Jude's and Reco's posts at midnight.
> Reco's answer of "lsblk -l -x name -o name,label" was better.
> I just tried Jude's as I read it after Jude's.
> I should reply only when really awake ;/
>

Hello. Once again I didn't read carefully and thought I was responding
to the Felix Miata subthread with the bash errors in *his* <script>,
which I believe exists.

Sorry for sowing confusion.

*Par ailleurs*, in the general context, I was looking at a method that
involved creating a variable rather than using redirection to a file. I
guess the following could be integrated directly into your
yet-to-be-written <script>.

list=$(lsblk -ln -o name,label | sort)

[toc] | [prev] | [next] | [standalone]


#204252

Frommick crane <mick.crane@gmail.com>
Date2019-01-09 17:20 +0100
Message-ID<xeoKd-4p7-7@gated-at.bofh.it>
In reply to#204239
On 2019-01-09 14:14, David Wright wrote:
> On Wed 09 Jan 2019 at 13:54:45 (+0000), Curt wrote:
>> On 2019-01-09, rhkramer@gmail.com <rhkramer@gmail.com> wrote:
>> > On Wednesday, January 09, 2019 03:01:42 AM Richard Hector wrote:
>> >> On 9/01/19 6:04 PM, Jude DaShiell wrote:
>> >> > lsblk -l -o name,label | sort | script
>> >>
>> >> lsblk -ln -o name,label |sort | <script>
>> >
>> > I'm not the OP, but I very much like the way you put script in angle brackets
>> > to show that is a parameter (mcow) and not a literal value!!
>> 
>> I'll see that affection for mundane angle brackets and raise you the
>> annoyance of not having received the vaguest clue as to what might be
>> found literally inside them (the pertinent part, at the very least).
> 
> I don't think the OP told us what the script was, but just that they
> want to pipe the output into "a script". Using angle brackets from the
> start (or knowing that script itself is a program) would have avoided
> the mess in the other subthread.
> 
> Cheers,
> David.

/usr/bin/script looks like it might be handy sometime ( didn't know 
about that )
there's a line in the answers to clean up the output.
https://superuser.com/questions/236930/how-to-clean-up-output-of-linux-script-command

mick



-- 
Key ID    4BFEBB31

[toc] | [prev] | [next] | [standalone]


#204260

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2019-01-09 20:10 +0100
Message-ID<xeroJ-64W-5@gated-at.bofh.it>
In reply to#204252
On Wed 09 Jan 2019 at 16:13:19 (+0000), mick crane wrote:
> On 2019-01-09 14:14, David Wright wrote:
> > On Wed 09 Jan 2019 at 13:54:45 (+0000), Curt wrote:
> > > On 2019-01-09, rhkramer@gmail.com <rhkramer@gmail.com> wrote:
> > > > On Wednesday, January 09, 2019 03:01:42 AM Richard Hector wrote:
> > > >> On 9/01/19 6:04 PM, Jude DaShiell wrote:
> > > >> > lsblk -l -o name,label | sort | script
> > > >>
> > > >> lsblk -ln -o name,label |sort | <script>
> > > >
> > > > I'm not the OP, but I very much like the way you put script in angle brackets
> > > > to show that is a parameter (mcow) and not a literal value!!
> > > 
> > > I'll see that affection for mundane angle brackets and raise you the
> > > annoyance of not having received the vaguest clue as to what might be
> > > found literally inside them (the pertinent part, at the very least).
> > 
> > I don't think the OP told us what the script was, but just that they
> > want to pipe the output into "a script". Using angle brackets from the
> > start (or knowing that script itself is a program) would have avoided
> > the mess in the other subthread.
> 
> /usr/bin/script looks like it might be handy sometime ( didn't know
> about that )
> there's a line in the answers to clean up the output.
> https://superuser.com/questions/236930/how-to-clean-up-output-of-linux-script-command

That perl script is useful, so it might be worth posting here:

perl -pe 's/\e([^\[\]]|\[.*?[a-zA-Z]|\].*?\a)//g' < typescript | col -b | less

I just ran a typescript of an expert Debian installation over ssh, and
I think that's the best representation of curses screens I've seen,
short of using cut and paste.

But returning to lsblk, I can't figure out why the OP's lsblk -l
appears in such an odd order. Does it differ from that given by
lsblk with no arguments?

I've checked the unsorted order of my /sys/dev/block, which is
essentially random, as is the order of block devices in the output
of mount, yet lsblk gives me a nice sorted lists:

$ lsblk -o name
NAME
sda
├─sda1
├─sda2
├─sda3
├─sda4
├─sda5
├─sda6
├─sda7
├─sda8
│ └─swanhome
├─sda9
├─sda10
├─sda11
├─sda12
├─sda13
└─sda14
sdb
└─sdb1
  └─luks-b1b5d363-c048-40e6-8030-fed7a20e37ab
sdc
  └─sdc1
$ lsblk -o name -l
NAME
sda
sda1
sda2
sda3
sda4
sda5
sda6
sda7
sda8
sda9
sda10
sda11
sda12
sda13
sda14
sdb
sdb1
sdc
sdc1
swanhome
luks-b1b5d363-c048-40e6-8030-fed7a20e37ab
$ 

The disadvantage (to me) with external sorting is that the order
becomes alphanumeric instead of numerical (though a script could
work around that by splitting the name field).

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#204265

FromMichael Stone <mstone@debian.org>
Date2019-01-09 22:40 +0100
Message-ID<xetJU-7p2-9@gated-at.bofh.it>
In reply to#204260
On Wed, Jan 09, 2019 at 12:45:02PM -0600, David Wright wrote:
>But returning to lsblk, I can't figure out why the OP's lsblk -l
>appears in such an odd order. Does it differ from that given by
>lsblk with no arguments?
>
>I've checked the unsorted order of my /sys/dev/block, which is
>essentially random, as is the order of block devices in the output
>of mount, yet lsblk gives me a nice sorted lists:

Without -x it's sorting in device major:minor order, which happens to be 
alphabetical in your install purely by chance.

[toc] | [prev] | [next] | [standalone]


#204277

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2019-01-10 02:00 +0100
Message-ID<xewRr-NZ-1@gated-at.bofh.it>
In reply to#204265
On Wed 09 Jan 2019 at 16:36:16 (-0500), Michael Stone wrote:
> On Wed, Jan 09, 2019 at 12:45:02PM -0600, David Wright wrote:
> > But returning to lsblk, I can't figure out why the OP's lsblk -l
> > appears in such an odd order. Does it differ from that given by
> > lsblk with no arguments?
> > 
> > I've checked the unsorted order of my /sys/dev/block, which is
> > essentially random, as is the order of block devices in the output
> > of mount, yet lsblk gives me a nice sorted lists:
> 
> Without -x it's sorting in device major:minor order, which happens to
> be alphabetical in your install purely by chance.

So, looking at the OP, is the order of sdc a temporary state of
affairs, produced by adding partitions to sdc while sde is plugged in
and blocking the sequence? (I've never seen one letter split.)

Or is it quite normal when you reach fifteen partitions? I can
understand that the devices seem to be assigned in blocks of sixteen,
but I slightly surprised that they would be assigned in a broken
sequence when they all present at boot time.

And surely sr0, sitting there in the middle, has a completely
different major number from sdX.

OP's report:

    However when I do
     > lsblk -l -o name,label
    I get
     > sdc14 good-fvwm
     > sdc15 tst_mysql
     > sde
     > sde1  debian-2-go
     > sr0
     > sdc16 tst_mariadb
     > sdc17 dummy
     > sdc18 target

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#204290

FromMichael Stone <mstone@debian.org>
Date2019-01-10 13:50 +0100
Message-ID<xeHWx-7FV-1@gated-at.bofh.it>
In reply to#204277
On Wed, Jan 09, 2019 at 06:45:22PM -0600, David Wright wrote:
>So, looking at the OP, is the order of sdc a temporary state of
>affairs, produced by adding partitions to sdc while sde is plugged in
>and blocking the sequence? (I've never seen one letter split.)

>Or is it quite normal when you reach fifteen partitions? I can
>understand that the devices seem to be assigned in blocks of sixteen,
>but I slightly surprised that they would be assigned in a broken
>sequence when they all present at boot time.

Historically the device numbers were assigned statically:
   8 block	SCSI disk devices (0-15)
		  0 = /dev/sda		First SCSI disk whole disk
		 16 = /dev/sdb		Second SCSI disk whole disk
		 32 = /dev/sdc		Third SCSI disk whole disk
		    ...
		240 = /dev/sdp		Sixteenth SCSI disk whole disk

There was a 15 partition limit. Now you can get more, but they're 
assigned dynamically, outside of the historic scheme.

>And surely sr0, sitting there in the middle, has a completely
>different major number from sdX.

Because scsi cdroms are a completely different device type than scsi 
disks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web