I have 2 files with following text:
OldFile:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_livecd-lv_root
18G 2.4G 15G 14% /
tmpfs 590M 276K 590M 1% /dev/shm
/dev/sda1 485M 31M 429M 7% /boot
NewFile
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_livecd-lv_root
18G 2.7G 15G 14% /
tmpfs 590M 264K 590M 1% /dev/shm
/dev/sda1 485M 31M 429M 7% /boot
/dev/sdb1 3.8G 1.1G 2.8G 28% /media/9C6F-1ECD
Now in output file I just want following line. as this is newly added.
/dev/sdb1 3.8G 1.1G 2.8G 28% /media/9C6F-1ECD
but instead I’m getting following output as one number is also changed from 2.4 to 2.7.
18G 2.7G 15G 14% /
/dev/sdb1 3.8G 1.1G 2.8G 28% /media/9C6F-1ECD
so this is creating problem for me. I just want completely newly added line.
First, put the parts you do want to compare onto the end, as so:
Then:
Note the use of
df -Pto ensure that the output from df is not split onto multiple lines (as in your example).By the way — obscuring your problem was supremely unhelpful. Please do not do this in the future.