I have du redirect into a file named stdout.txt, and the file's contents read as follows(for example):
4.0K ./Makefile.am
20K ./dfasearch.c
8.0K ./dosbuf.c
4.0K ./egrep.sh
84K ./grep.c
4.0K ./grep.h
8.0K ./kwsearch.c
36K ./kwset.c
4.0K ./kwset.h
12K ./pcresearch.c
4.0K ./search.h
4.0K ./searchutils.c
4.0K ./system.h
From that file, I would like to be able to display only lines above or below a given size value. "sort -h" gets me part of the way there, I think, but I'm not sure how to go about culling the lines I wouldn't need. For instance, let's say I only wanted to print lines that represented a 12K or less file, my output should look something like:
4.0K ./Makefile.am
8.0K ./dosbuf.c
4.0K ./egrep.sh
4.0K ./grep.h
8.0K ./kwsearch.c
4.0K ./kwset.h
12K ./pcresearch.c
4.0K ./search.h
4.0K ./searchutils.c
4.0K ./system.h
Is there a common tool that naturally sorts by human-readable sizes and displays only the lines below (in this case) a given size? Ideally, I'd like to have some bash code that could be used to generate this output above or below a user-provided number that could be denoted by K, MB, or GB, etc.