grep and exact matches help..

Gary Johnson garyjohn@spk.agilent.com
Tue Apr 3 22:05:00 GMT 2007


On 2007-04-03, Dave Korn wrote:

>   BTW2, I assume we're still talking about your script from before.
> Seriously, use "ls -1" rather than "ls -l" (that is, use a one instead of an
> L), because then you get /just/ the filenames, one per line, and won't have to
> worry about parsing the name out from amongst all those permission flags and
> datestamps.

On 2007-04-03, Peter Rehley wrote:

> Here is one possible solution
> 
> ls -1a | grep winops | grep -v winops-hp
> 
> or maybe this
> 
> ls -1a | sed -e '/winops-hq/d'

If you're piping 'ls' into another command, the -1 isn't necessary.  
'ls' detects that its stdout is not a tty and delivers single-column  
output automatically.

Regards,
Gary

-- 
Gary Johnson                 | Agilent Technologies
garyjohn@spk.agilent.com     | Mobile Broadband Division
                             | Spokane, Washington, USA

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list