9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] trailing newline in awk
@ 2012-01-26 12:15 dexen deVries
  2012-01-26 13:17 ` hugo rivera
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: dexen deVries @ 2012-01-26 12:15 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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''



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-26 15:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-26 12:15 [9fans] trailing newline in awk dexen deVries
2012-01-26 13:17 ` hugo rivera
2012-01-26 13:20 ` Steve Simon
2012-01-26 15:32 ` Jonathan Cast

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).