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

Sapan Ganguly sapan.ganguly at gmail.com
Mon Jul 18 13:35:55 UTC 2005


Thanks for your reply but I tried that too and it still becomes one
long line in the new file.

On 7/18/05, Dickon Hood <sclug at splurge.fluff.org> wrote:
> 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