Find the answer to your Linux question:
Results 1 to 3 of 3
Hi. I want to get the last term of an unknown-sized text line, by usig the awk command. Is there any variable which points to the last term of a ...
  1. #1
    Just Joined!
    Join Date
    Dec 2010
    Posts
    2

    Cool ksh - awk

    Hi.

    I want to get the last term of an unknown-sized text line, by usig the awk command.
    Is there any variable which points to the last term of a text line ?

    (obviously, y can obtain that term if i knew how many terms does the line have... i.e. awk '{print $12}' ; if we are talking about a 12-terms text line)

    I wonder if there is an option like $?, to get the last term.

    Thanks in advance

  2. #2
    Linux User Manko10's Avatar
    Join Date
    Sep 2010
    Posts
    250
    Hi, try
    Code:
    awk '{ print $(NF) }'
    Refining Linux Advent calendar: “24 Outstanding ZSH Gems

  3. #3
    Just Joined!
    Join Date
    Dec 2010
    Posts
    2
    thk a lot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...