Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

awk & skipping blank rows under a column 1

Status
Not open for further replies.

gatetec

MIS
Mar 22, 2007
420
0
0
US
ls -al *prod_* | awk '{ print $10}'

This returns blank rows along with the rows with data.
I'd like to omit the blank rows so that I can have the rows with data only.

Pls advise.

thx much
 
What are you looking at by choosing $10? usually there are 9 field in the ls -al output! unless there is a symbolic link or so!

Never mind, Try this:

ls -al | awk '{print $10}' | awk 'length >1'

Regards,
Khalid

 
Why 2nd awk process?

[tt]ls -al | awk '{if ($10) print $10}'[/tt]

But I only get "->" strings from the long listing of symlinks

or on /dev, the name of all 'c' or 'b' devices...


HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top