9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: dexen deVries <dexen.devries@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: [9fans] trailing newline in awk
Date: Thu, 26 Jan 2012 13:15:09 +0100	[thread overview]
Message-ID: <201201261315.09613.dexen.devries@gmail.com> (raw)

hi list,

can't wrap my head around this: in an awk script, how to take some action if a 
file lacks last trailing Line Feed?

i want to modify files with contents like:
text LF
text LF
text

and leave undisturbed files with content like:
text LF
text LF
text LF

in other words, i want to either:
 - match line that is empty and is last line of file (awk doesn't seem to take 
any action on such line), or, alternatively,
 - match a line that is last line of file and lacks terminating LF.

-- 
dexen deVries

[[[↓][→]]]

Already many of the mutants disguised as human beings are walking the streets 
of Earth's cities.
 -- Music Instructor, ``Electro City''



             reply	other threads:[~2012-01-26 12:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-26 12:15 dexen deVries [this message]
2012-01-26 13:17 ` hugo rivera
2012-01-26 13:20 ` Steve Simon
2012-01-26 15:32 ` Jonathan Cast

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201201261315.09613.dexen.devries@gmail.com \
    --to=dexen.devries@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).