List Info

Thread: Effectively detaching 'less' from a pipe




Effectively detaching 'less' from a pipe
user name
2007-02-26 21:27:41
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?

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-questionsfreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-que
stions
To unsubscribe, send any mail to
"freebsd-questions-unsubscribefreebsd.org"

Re: Effectively detaching 'less' from a pipe
country flaguser name
United States
2007-02-26 21:46:53
[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 Goldberg                        http://www.goldmark.org
/jeff/

_______________________________________________
freebsd-questionsfreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-que
stions
To unsubscribe, send any mail to
"freebsd-questions-unsubscribefreebsd.org"

Re: Effectively detaching 'less' from a pipe
country flaguser name
United States
2007-02-26 22:16:09
On Feb 26, 07, at 8: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.

Don't use "less".  Use "head" instead:

		command | head -n N          (where N is the number of
lines of the  
output you want to see)

HTH!           --  Woody

_______________________________________________
freebsd-questionsfreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-que
stions
To unsubscribe, send any mail to
"freebsd-questions-unsubscribefreebsd.org"

Re: Effectively detaching 'less' from a pipe
country flaguser name
United Kingdom
2007-02-27 05:21:53
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-questionsfreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-que
stions
To unsubscribe, send any mail to
"freebsd-questions-unsubscribefreebsd.org"

Re: Effectively detaching 'less' from a pipe
country flaguser name
United States
2007-02-27 09:35:40
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-questionsfreebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-que
stions
> To unsubscribe, send any mail to
"freebsd-questions-unsubscribefreebsd.org"
_______________________________________________
freebsd-questionsfreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-que
stions
To unsubscribe, send any mail to
"freebsd-questions-unsubscribefreebsd.org"

Re: Effectively detaching 'less' from a pipe
user name
2007-02-27 10:34:42
Check the man pages for tee and head. From your description,
they may
work better. If nothing else, you can probably figure out
something
better than what you're doing now.

And please don't cross-post. I highly doubt everyone on all
those
lists/groups is subscribed to all the others.

~Ryan

On 2/26/07, Kelly Jones <kelly.terry.jonesgmail.com> 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?
>
> 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)
>
_______________________________________________
freebsd-questionsfreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-que
stions
To unsubscribe, send any mail to
"freebsd-questions-unsubscribefreebsd.org"

[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )