Results 1 to 5 of 5

Thread: bash blkid command, parsing values

  1. #1

    Default bash blkid command, parsing values

    I'm been using 'blkid -o list'. However this causing me problems parsing spaces in file names. 'blkid' is missing the mount point. I'm struggling to find a way to get three values. http://linux.die.net/man/8/blkid I need to know device id, type, partition label, and if the device is mounted. Then divide into linux and mswin partitions by bash script or command. MSWIN: FAT32, NTFS, etc. Playing with command values, I found 'label=' and 'partlabel='. It's very confusing. I need help getting the output format right.

  2. #2
    Join Date
    Sep 2012
    Posts
    5,230

    Default Re: bash blkid command, parsing values

    blkid does not know aything about mounted status. Use lsblk instead.

  3. #3

    Default Re: bash blkid command, parsing values

    Quote Originally Posted by arvidjaar View Post
    blkid does not know aything about mounted status. Use lsblk instead.
    'blkid -o list' When a device isn't mounted, it shows the line '(not mounted)'. I used it to mount drives if I not mounted. It worked very well. However, spaces in filenames cause a bug.

    Thanks for the info. I'll use that command for parse and post again.

  4. #4
    Join Date
    Sep 2012
    Posts
    5,230

    Default Re: bash blkid command, parsing values

    Quote Originally Posted by lord_valarian View Post
    'blkid -o list' When a device isn't mounted, it shows the line '(not mounted)'.
    Indeed. Never used it before and documentation is cursory. Thanks!

  5. #5

    Default Re: bash blkid command, parsing values

    Quote Originally Posted by arvidjaar View Post
    Indeed. Never used it before and documentation is cursory. Thanks!
    If you trying to parse drive info using either lsblk or blkid, I'v figured out how to do it without spaces in filenames being a problem. It involves using some complex string manipulation and use of pipes. Take a look at the future scanvirus beta3 release. Don't forget to give me credit if you use the code.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •