The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 11-24-2008
valluvan valluvan is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 27
Quote:
Originally Posted by Franklin52 View Post
Try this:

Code:
ls -l |awk '/^-/ && $NF !~ /^abc/ && $NF !~ /^efg/ {print $NF}'
Thanks Frank when I assign this code to a variable and try to print the variable contents it just prints nothing.

I do this:

FILELIST=`ls -l |awk '/^-/ && $NF !~ /^abc/ && $NF !~ /^efg/ && $NF ~ /.out/ {print $NF}'`
echo $FILELIST


Neither does this work:
FILELIST=`echo ls -l |awk '/^-/ && $NF !~ /^abc/ && $NF !~ /^efg/ && $NF ~ /.out/ {print $NF}'`
echo $FILELIST

Please help..Ideally it shold be printing the file name whose extension is .out and not begining with abc or efg