Re: Effectively detaching 'less' from a pipe
On Mon, Feb 26, 2007 at 08:27:41PM -0700, Kelly Jones wrote: > I often run commands piped to 'less', to make sure the command is > working OK by looking at the first few lines of output. > > Once I'm convinced, though, I'd like to "get rid" of less, and just > have the rest of stdout spewed to the terminal (and/or /dev/null > and/or to a file I specify). > > In other words, I want to stop hitting 'space' until my program terminates. You got several good suggestions. Along a somewhat different path, have you checked out script(1). It isn't quite what you are asking, but might also be helpful. Just type 'script some_file_name' and it will dump all screen output to that file until you exit script with a CTRL-D. jerry > > How can I do this? > > My current kludges (both ugly): > > 1. do "command > file" and then "tail -f file | less" (this mostly > works, but takes a while to get started because of buffering issues) > > 2. do "command | less", and once I'm happy w/ the output, hit 'q' to > quit less (and thus terminate program) and then do "command > > /dev/null" (works, but wastes time, since I have to run the command > once just to look at the first few lines and then abort it) > > -- > We're just a Bunch Of Regular Guys, a collective group that's trying > to understand and assimilate technology. We feel that resistance to > new ideas and technology is unwise and ultimately futile. > ___ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "[EMAIL PROTECTED]" ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Effectively detaching 'less' from a pipe
In freebsd-questions Digest, Vol 167, Issue 5 At Message: 19 On Mon, 26 Feb 2007 20:27:41 -0700, Kelly Jones <[EMAIL PROTECTED]> wrote: > I often run commands piped to 'less', to make sure the command is > working OK by looking at the first few lines of output. > > Once I'm convinced, though, I'd like to "get rid" of less, and just > have the rest of stdout spewed to the terminal (and/or /dev/null > and/or to a file I specify). > > In other words, I want to stop hitting 'space' until my program terminates. What Matthew said about using 'F' to follow output tail is very handy. > How can I do this? > > My current kludges (both ugly): > > 1. do "command > file" and then "tail -f file | less" (this mostly > works, but takes a while to get started because of buffering issues) > > 2. do "command | less", and once I'm happy w/ the output, hit 'q' to > quit less (and thus terminate program) and then do "command > > /dev/null" (works, but wastes time, since I have to run the command > once just to look at the first few lines and then abort it) When you've piped something to less that you want to save, or save some part of, press 'g' to go to top of file (or position the top of what you want to save at top of screen), press 'm' and some letter (I mostly use 'mm' for speed) to mark that spot, press 'G' to go to bottom of file (or otherwise position the end of what you want at bottom of screen), then press '|' then (as prompted for) the letter of your mark (eg here '|m') Then at the '!' command prompt offered, type 'cat - >somepath/filename' to capture the file, or snippet. If you use >> instead of > you can cat interesting sections of your output to a file; using up/down arrow at '!' you can recall commands used, for each mark/move/pipe/cat sequence. Cheers, Ian ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Effectively detaching 'less' from a pipe
Matthew Seaman wrote: Kelly Jones wrote: Once I'm convinced, though, I'd like to "get rid" of less, and just have the rest of stdout spewed to the terminal (and/or /dev/null and/or to a file I specify). In other words, I want to stop hitting 'space' until my program terminates. Hit F Makes less work rather like tail(1). Once your inferior process has finished you need to hit Ctrl-C and then q to quit from less(1). You learns something new every day... In a similar vein, I use G which jumps to the end-of-file. If there is a lot of output less does nothing until it hits EOF and then just shows you the end of the output. I suspect that of being quicker since it won't spend any time scrolling output to the screen. --Alex ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Effectively detaching 'less' from a pipe
Kelly Jones wrote: > Once I'm convinced, though, I'd like to "get rid" of less, and just > have the rest of stdout spewed to the terminal (and/or /dev/null > and/or to a file I specify). > > In other words, I want to stop hitting 'space' until my program terminates. Hit F Makes less work rather like tail(1). Once your inferior process has finished you need to hit Ctrl-C and then q to quit from less(1). Cheers, Matthew -- Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW signature.asc Description: OpenPGP digital signature
Re: Effectively detaching 'less' from a pipe
[I've removed the lists for which I'm not a member] On Feb 26, 2007, at 9:27 PM, Kelly Jones wrote: I often run commands piped to 'less', to make sure the command is working OK by looking at the first few lines of output. Once I'm convinced, though, I'd like to "get rid" of less, and just have the rest of stdout spewed to the terminal (and/or /dev/null and/or to a file I specify). In other words, I want to stop hitting 'space' until my program terminates. How can I do this? man tee so command | tee outputfile | less Then :q out of less when you are done and the output will have gone to outputfile -j -- Jeffrey Goldberghttp://www.goldmark.org/jeff/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"