I have a file like below:
blablabla
blablabla
***
thingsIwantToRead1
thingsIwantToRead2
thingsIwantToRead3
blablabla
blablabla
I want to extract the paragraph with thingsIwantToRead
. When I had to deal with such a problem, I used AWK like this:
awk 'BEGIN{ FS="Separator above the paragraph"; RS="" } {print $2}' $file.txt | awk 'BEGIN{ FS="separator below the paragraph"; RS="" } {print $1}'
And it worked.
In this case, I tried to put FS="***"
, "\*{3}"
, "\*\*"
(it is not working because AWK treats it like a normal asterisk), "\\*\\*"
or whatever regex I could think of, but it's not working (it's printing nothing).
Do you know why?
If not, do you know another way to deal with my problem?
Below an extract of the file I want to parse:
13.2000000000 , 3*0.00000000000 , 11.6500000000 , 3*0.00000000000 , 17.8800000000
Blablabla
SATELLITE EPHEMERIS
===================
Output frame: Mean of J2000
Epoch A E I RA AofP TA Flight Ang
*****************************************************************************************************************
2012/10/01 00:00:00.000 6998.239 0.001233 97.95558 77.41733 89.98551 290.75808 359.93398
2012/10/01 00:05:00.000 6993.163 0.001168 97.95869 77.41920 124.72698 274.57362 359.93327
2012/10/01 00:10:00.000 6987.347 0.001004 97.96219 77.42327 170.94020 246.92395 359.94706
2012/10/01 00:15:00.000 6983.173 0.000893 97.96468 77.42930 224.76158 211.67042 359.97311
<np>
----------------
Predicted Orbit:
----------------
Blablabla
And I want to extract:
2012/10/01 00:00:00.000 6998.239 0.001233 97.95558 77.41733 89.98551 290.75808 359.93398
2012/10/01 00:05:00.000 6993.163 0.001168 97.95869 77.41920 124.72698 274.57362 359.93327
2012/10/01 00:10:00.000 6987.347 0.001004 97.96219 77.42327 170.94020 246.92395 359.94706
2012/10/01 00:15:00.000 6983.173 0.000893 97.96468 77.42930 224.76158 211.67042 359.97311
And the command I tried to use to get the numbers after the line of *'s:
`awk 'BEGIN{ FS="\\*{2,}"; RS="" } {print $2}' file | awk 'BEGIN{ FS="<np>"; RS="" } {print $1}'`
***
after the target paragraph? – terdon Jun 10 '15 at 09:59*
and--
lines) actually part of the line? Do you want the data between****
and<np>
? Or until the next blank line? – terdon Jun 10 '15 at 14:03<np>
in the file you wish to edit delimit the end of the paragraph - or is it a blank line instead? If you don't know the answer to that question then you have asked the wrong question. You need to first ask: What the hell is***
separated sections) are are we expected to expect to be in your output? – kos Jun 10 '15 at 18:44***
separated sections always terminated by a<np>
line? – kos Jun 10 '15 at 19:11<np>
line (special character I dont know the meaning of). But I need to parse different files of the same type as the file I put as an example. – JoVe Jun 11 '15 at 08:58