I have a vmstat dump file that has the header and values in this format
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
12 0 5924396 20810624 548548 935160 0 0 0 5 0 0 60 5 34 0 0
12 0 5924396 20768588 548548 935160 0 0 0 0 1045 1296 99 0 0 0 0
12 0 5924396 20768968 548548 935452 0 0 0 32 1025 1288 100 0 0 0 0
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
4 0 5924396 20768724 548552 935408 0 0 0 92 1093 1377 33 0 67 0 0
I'm writing a script in bash that extracts just the lines containing lines with numbers i.e. values and remove all lines containing the alphabet. How do I do that
grep '[0-9]' filenameshould work. Then save the output to whatever file you want. (awkcould do the same pretty easily.) I'm assuming the file is as you show - the non-numeric lines have no numbers in them. If this isn't the case, you could tweak the search.