srinivasan <srinivasan....@gmail.com> writes: > Even after changing as per the below > "blkid -o export %s | grep 'TYPE' | cut -d'=' -f3" > or: > 'blkid -o export %s | grep "TYPE" | cut -d"=" -f3' > or: > "blkid -o export %s | grep \"TYPE\" | cut -d\"=\" -f3" > > Still my output is: > */dev/mmcblk1p1: LABEL="efi" UUID="1084-AA42" TYPE="vfat"* > > My expected output should be only: > *vfat* > > Could you guys please do the needful?
Why not blkid %s -o value --match-tag TYPE ? Or, better still, lsblk %s -n -o FSTYPE It's not easy to answer your question about fixing the line you have, because the output you are getting it not consistent with what you are showing. (And I can't find the original post that presumably has Python code I could run myself.) The format I get with -o export is: DEVNAME=/dev/sda1 UUID=2726bf5f-2655-4986-815d-e4532374f218 TYPE=ext3 PARTUUID=000453d3-01 for which "blkid %s -o export | grep TYPE | cut -c6-" would work. Alternatively I get the result you want from "blkid %s -o export | grep TYPE | cut -d= -f2" Note that "TYPE" and "=" don't really need to be quoted at all. Someone suggested sed, and that too can be used like this: blkid %s -o export | sed -ne '/TYPE=/s///p' -- Ben. -- https://mail.python.org/mailman/listinfo/python-list