I have the below output
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda3 60300484 18883824 38304156 34% /
/dev/sda1 1046516 8604 1037912 1% /boot/efi
tmpfs 4120800 0 4120800 0% /dev/shm
psnfs1:/SDepot 629145600 400663744 228481856 64% /depot
psnfs1:/vol/ghome/ghome/support/kumar
1287651328 1065510400 222140928 83% /home/kumar
psnfs2:/vol/us_nhome2/us_nishome2/shaw
1073741888 799816192 273925696 75% /home/shaw
psnfs2:/vol/us_nhome2/us_nishome2/asimon
1073741888 799816192 273925696 75% /home/asimon
Where I am using (?xms)(^[/\w:]+.*?)(?=^[/\w:]+|\Z) to get each row, later i use \s to extract each column values from the prev regex output, but the problem is I also get the headings (Filesystem 1K-blocks Used Available Use% Mounted on). How can i omit them? Also explain the regex please 🙂 Thanks
If you’re building this into a shell pipeline, it’d probably be easier to use
tail(1)than building an even more complicated regex:vs
From the
tail(1)manpage:And if it were me, I’d probably use
awk(1)to get to specific columns: