Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] pattern matching



Hi,

--- roy lo wrote
> 
> for awk
>     Pattern="$1"; shift
>     awk '{
>      if ( match ($0, /'"$Pattern"'/) ) {
>   print substr ($0, RSTART, RLENGTH)
>      }
>  }
>     ' "$@"

--- "Stephen J. Turnbull" wrote:
> grep -e 'PATTERN' | sed -e 's/.*\(PATTERN\).*/\1/'
> perl -ane 'print "$&\n" if /PATTERN/'


you guys are really clever.

but my little grep(1) do it for me with,
 $ grep -o PATTERN file

:-)


__________________________________________________
Do You Yahoo!?
http://bb.yahoo.co.jp/

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links