using grep
So i have a few question:
1. How do I grep between keywords? I want to grep a section between keyword a and keyword b. 2. how do i extend some columns so they look better when using grep. I am doing the following: lynx http://money.cnn.com/data/ipo/upcoming/ and want this info: Upcoming IPOs | Withdrawn IPOs Company Shares Range Primary Underwriter Expected SuccessFactors (SFSF) 0790000 8.00 - 10.00 Morgan Stanley Iggys House (IGGY) 1400000 6.00 - 6.00 Northland Securities CreditCards.com (CCRD) 10725000 13.00 - 15.00 Credit Suisse ... when i use w3m http://money.cnn.com/data/ipo/upcoming/ | grep -B1 -A40 "Upcoming IPOs" i get: SuccessFactors 8.00 Morgan Freddie, Fannie hunt (SFSF) 10790000 - Stanley 11/20 Report for a few billion 10.00 Retire without Iggys House 6.00 Northland pinching pennies (IGGY) 1400000 - Securities 11/20 Report Oil makes fresh run 6.00 at $100, hits record 13.00 Credit high CreditCards.com 10725000 - Suisse 11/20 Report (CCRD) 15.00 so my first question is how do i use the keyword to search between Upcoming IPOs and more markets? My solution is to use -B and -A to accomplish this, but i know there is a better way. the second question is how to i organize all the columns so they are like the first section? I want it to look nice so Fannie hunt (SFSF) is on the same line. thank you |
Hard to say since I can't see markets in your text. If they're on separate lines
awk's the tool for the job. Code:
$ lynx --dump --width=132 http://money.cnn.com/data/ipo/upcoming/ |awk '/Upcoming IPOs/,/Markets/' Cheers, Tink |
thank you so much, this exactly what i needed!
|
All times are GMT -5. The time now is 12:41 AM. |