[GLLUG] grep help
Mike Szumlinski
szumlins at mac.com
Wed May 11 14:59:01 EDT 2005
Okay, I'm trying to parse a large amount of report files for some
people here at work and I'm pretty sure grep is the tool I need. The
one thing I don't know how to do is throw away some of the information
I'm getting.
Right now, my expression is as follows:
---
myhost:~/Desktop] szumlins% grep "Current\ Machine\|Total\
Files\|bytes" sometextfile.txt
Current Machine: whoeverthemachinebelongsto
1 File(s) 3,492,199 bytes
2 File(s) 1,374,386 bytes
14 File(s) 60,253,470 bytes
12 File(s) 66,581,162 bytes
16 File(s) 42,781,520 bytes
16 File(s) 60,159,760 bytes
5 File(s) 17,112,793 bytes
12 File(s) 54,080,486 bytes
17 File(s) 67,632,351 bytes
1 File(s) 2,624,518 bytes
Total Files Listed:
96 File(s) 376,092,645 bytes
0 Dir(s) 30,038,294,528 bytes free
---
All of the text files have "Current Machine:" in the first line. All
of the text files also have "Total Files Listed:" and then the
information as the last 3 lines. I only want that information, not all
the individual files above. Any quick ideas how I can slap that
request back into a regexp and eliminate the multiple lines so that my
output looks like this:
---
Current Machine: whoeverthemachinebelongsto
Total Files Listed:
96 File(s) 376,092,645 bytes
0 Dir(s) 30,038,294,528 bytes free
---
I'm sure this is a quickie for some of you guys, I really appreciate
the help.
-Mike
More information about the linux-user
mailing list