[sclug] Redirecting Tail to a file preserving end of lines

Dickon Hood sclug at splurge.fluff.org
Mon Jul 18 13:31:17 UTC 2005


On Mon, Jul 18, 2005 at 14:18:35 +0100, Sapan Ganguly wrote:
: Hello, how are you all?

: I've been scratching my head over this one for the past hour or two,
: how do I take the last line of a bunch of files and put them into a
: new file?  This is what I have been trying -

: # tail --lines=1 --silent *.csv >> newfile

: For some reason the end of lines aren't preserved, newfile ends up
: being one really long line.

: I've tried a few other ways but I get the same result.

: Any ideas?

for i in *.csv; do tail -1 $i; done > newfile

Works for me.

-- 
Dickon Hood

Due to constant nagging to change it, my .sig is temporarily unavailable.
Normal service will be resumed as soon as possible.  We apologise for the
inconvenience in the meantime.


More information about the Sclug mailing list