Unix Shell - Re: how to find the first occurence of an specific text starting

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > March 2005 > Re: how to find the first occurence of an specific text starting





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: how to find the first occurence of an specific text starting
Michael Tosch

2005-03-31, 3:01 am

John Savage wrote:
> Stephane CHAZELAS <this.address@is.invalid> writes:
>
>
>
> If speed is important, sed might have an advantage here:


sed -n '/Link/h;${g;p;}' /var/log/messages

>
> sed -n '/ Link /h;${g;/./p;}' /var/log/messages


is equivalent to

awk '/ Link /{l=$0}END{if(l!="")print l}' /var/adm/messages


--
Michael Tosch @ hp : com
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com