Seems impossible to do in awk, but I could be wrong. In ssam is easy: % ssam -ne 'y/.+\n/p' file
prints the last line if it's missing the line feed. 2012/1/26 dexen deVries <[email protected]>: > 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'' > -- Hugo
