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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Output every field except the last

Status
Not open for further replies.

coops1102

MIS
May 28, 2003
1
GB
I have a file containing a list of directories of varying depths. Basically I want to remove the last directory (i.e field) in each case.
I know I can get at the last field with NF but I don't know how to output everything except $(NF), any suggestions appreciated.
 
Try

{
$NF=""
print
}

CaKiwi

"I love mankind, it's people I can't stand" - Linus Van Pelt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top