Running sed and counting number of lines processed

view full story

http://www.unix.com – Code: /bin/sed -n ';4757335,$ p' | wc -l /bin/sed -n ';4757335,$ p' | egrep "Failed" | egrep -c "PM late arrrival" how can i combine the above two sed commands into one? i want to count the number of lines between the specified line number and the end of the file. AND and i want to count how many lines contain a specified set of strings within those lines. i dont want to run these sed commands separately because they would add greatly to the time it takes for the script to complete. (HowTos)