Re: Line-by-line functionality for rev(1)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Paul de Weerd
Date: Wednesday, December 29, 2010 - 3:12 am

On Wed, Dec 29, 2010 at 11:03:22AM +0300, Vadim Zhukov wrote:
| On 29 December 2010 c. 04:12:34 Jeremy C. Reed wrote:
| > tail -r
| 
| tail(1) saves all data in memory. So if you want to reverse very big file
| (say, some sort of log) you'll have to construct monsters with help of
| awk/perl/etc.

It does that for non-regular files, sure (how else would you do it ?
You use a swapfile in your patch.  So you assume (probably quite
fairly, but not always valid I suppose) that there's more diskspace
available than memory but you do so at significant cost in terms of
disk access).

But see /usr/src/usr.bin/tail/reverse.c:r_reg for regular files, this
basically does what you do in print_swap.

Paul 'WEiRD' de Weerd

-- 
+++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
                 http://www.weirdnet.nl/
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Line-by-line functionality for rev(1), Vadim Zhukov, (Tue Dec 28, 5:45 pm)
Re: Line-by-line functionality for rev(1), Jeremy C. Reed, (Tue Dec 28, 6:12 pm)
Re: Line-by-line functionality for rev(1), Vadim Zhukov, (Wed Dec 29, 1:03 am)
Re: Line-by-line functionality for rev(1), Paul de Weerd, (Wed Dec 29, 3:12 am)
Re: Line-by-line functionality for rev(1), Vadim Zhukov, (Wed Dec 29, 4:23 am)