Just curious if there's a way I can show the output between two markers?
I was trying grep -r "<cron_expr>.*</run>" * but it doesn't seem to be returning as
expected. Which is to say its not showing newline breaks?
So I guess the the real question is how can i find out what between two markers regardless of newline BS. I can't install on this system so no pcregrep =(
Maybe AWK?
(P.s. someone should make an AWK tag)
<crontab>
<jobs>
<enterprise_reward_balance_warning_notification>
<schedule><cron_expr>1 * * * *</cron_expr></schedule>
<run><model>enterprise_reward/observer::scheduledBalanceExpireNotification</model></run>
</enterprise_reward_balance_warning_notification>
<enterprise_reward_expire_points>
<schedule><cron_expr>1 * * * *</cron_expr></schedule>
<run><model>enterprise_reward/observer::scheduledPointsExpiration</model></run>
</enterprise_reward_expire_points>
</jobs>
</crontab>
I just want to show whats on the <schedule> and <run> line(s if more than one, like above) anytime I see and what file they're in.
grepandsedare both line-oriented.awkcan use an arbitrary delimiter in place of newline, but still needs some kind of delimiter. What exactly are you looking for? You may be going about it the wrong way (for example, none of these tools is really appropriate for HTML/XML, and not ideal for JSON). – geekosaur May 4 '12 at 21:45