Hi I am a python bigginer, I have a scenario where I need to search and select a particular value from linux command "df -h".

dumpe2fs 1.42.13.x5 (23-Mar-2017)
Inode count:              786432000
[root@copper02 ~]#

In this above output I need to store the inode count number in to a variable to use it for further calculation.
Can anyone explain how to use python regular expressions to do the above task?

You don't need a regex for that. Just take any line starting with Inode count, split on blanks, then take the last element. Or, if you pipe the output from df to grep you can filter out only the Inode count lines. Pipe the output from that to your script and read the values from stdin.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.