Mailing List Archive


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

Re: [tlug] grep sort of thing



> 
> I want to display strings from a text file(s) based on a reg exp, sort
> of like egrep but only displaying the matched string not the whole line
> from the file.


For what it is worth here is my solution which is now on the path as
'filter'. it reads from stdin. I guess I could check to see if a file
arg was handed and then read from that file but this is fine.

#!/bin/bash
/usr/bin/perl -ne 'print $&, "\n" if /'$1'/;'

Thanks everyone

Brett








Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links