Learn something new every day

I was testing a disk and noticed that it had more data on it than I expected. Since everything is Gigabytes now, it doesn't even make sense to start going door to door looking for something that is wrong. I was using the "du -h" command to look at usage and I wanted to see just those entries in the "G" for Gigabyte range.

I first solved the problem by catching the #.#G format with :

du -h | grep "\..G"

That got the elements that I wanted, but the reason that \t didn't work was still bugging me. So I tried this:

du -h | grep "G\t"

It didn't work and I tried it with space also and no luck. Since it should have matched empty space, I went to find out why it didn't. It turns out that grep doesn't recognize \t as tab, and you need to use the perl extensions to find a tab AFAIK. So I tried :

du -h | grep -P "G\t"

That worked and I then had a nice little list of what elements were greater than a Gigabyte and I solved all the problems.

0 comments:

Automated Intelligence

Automated Intelligence
Auftrag der unendlichen LOL katzen