It has been a year now since I completed my UNIX/Linux certification training and every once and awhile I think about my friend Perl, but I really enjoy helping others with some simple needs. Ben (yeah, I got him using WordPress too ;)) aked me a great recently:
Question: If i have a huge log text fie and i want to pull a range of lines out of the middle, how can I easily do this?
Answer: sed -n '3,6 p' /var/log/httpd/error_log
Answer broken down:
sed is the UNIX tool I chose for this. -n is used so that sed does not print out more than what I need.
'3,6 p'indicates that I want lines 3-6 of the log file to print out (in the command line) and the p is used for: "If the substitution was made, then print the new pattern space."
/var/log/httpd/error_log specifies the log file that I need to extract data from
Hope this comes in handy!
[tags] sed [/tags]

