Fedora List:
I can run "ls -FR" on a directory and get a lovely listing with lots of color coded information to let me know what is what. I have hit a directory that is big enough that scrolling though the output isn't efficient. I would like to capture the output of "ls -FR" into a file that preserves the color coding (I don't want to read each file as I wish to visually scan to see if something isn't right and color is a great way to see it).
My attempts with "more" have stripped color. So has "less". Does anyone have an idea how to capture the output of "ls -FR" that keeps the color coding?
This is a low priority item ... just something that would be nice to be able to do
Thanks in advance, Paul
On 07/31/2012 02:15 PM, Paul Allen Newell wrote:
Fedora List:
I can run "ls -FR" on a directory and get a lovely listing with lots of color coded information to let me know what is what. I have hit a directory that is big enough that scrolling though the output isn't efficient. I would like to capture the output of "ls -FR" into a file that preserves the color coding (I don't want to read each file as I wish to visually scan to see if something isn't right and color is a great way to see it).
My attempts with "more" have stripped color. So has "less". Does anyone have an idea how to capture the output of "ls -FR" that keeps the color coding?
This is a low priority item ... just something that would be nice to be able to do
Thanks in advance, Paul
script -c "ls -FR --color" outfile
On 7/30/2012 11:22 PM, Ed Greshko wrote:
script -c "ls -FR --color" outfile
Ed:
Thanks for the very prompt reply. I tried the command and I am not getting what I expect when I open the file. Part of the problem (maybe large part) is that I am opening in vim. What editor should I use for seeing this as all I get in vim is 1) no color and 2) alot of control-M's
Best, Paul
On 07/31/2012 02:48 PM, Paul Allen Newell wrote:
Thanks for the very prompt reply. I tried the command and I am not getting what I expect when I open the file. Part of the problem (maybe large part) is that I am opening in vim. What editor should I use for seeing this as all I get in vim is 1) no color and 2) alot of control-M's
OK..... In my haste, I misunderstood your needs.
What I gave you basically captures the control characters which produce the colors in the terminal. So, if you "cat" the file you'll see the colors.
At the moment, I can't think of what editor would retain the colors. :-(
I'll try to think a bit more....
On 07/31/2012 03:45 PM, Ed Greshko wrote:
I'll try to think a bit more....
I just realized you mentioned "more" and "less" in your original post....
less -r outfile
Will show the colors.... Is that sufficient?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 07/31/2012 02:53 AM, Ed Greshko wrote:
On 07/31/2012 03:45 PM, Ed Greshko wrote:
I'll try to think a bit more....
I just realized you mentioned "more" and "less" in your original
post....
less -r outfile
Will show the colors.... Is that sufficient?
Wouldn't -R work better then -r?
Mikkel - -- Do not meddle in the affairs of dragons, for thou art crunchy and taste good with Ketchup!
On 07/31/2012 07:12 PM, Mikkel L. Ellertson wrote:
Wouldn't -R work better then -r?
Yes, it would be better.
On Tue, Jul 31, 2012 at 10:10:22AM -0700, Joe Zeff wrote:
On 07/31/2012 12:45 AM, Ed Greshko wrote:
At the moment, I can't think of what editor would retain the colors. :-(
If it's too long, run it through either more or less.
I think the complete command that would satisfy the OP is:
ls -C --color=always | less -R
On 7/31/2012 4:35 AM, Ed Greshko wrote:
On 07/31/2012 07:12 PM, Mikkel L. Ellertson wrote:
Wouldn't -R work better then -r?
Yes, it would be better.
Ed and Mikkel:
+++ script -c "ls -FR --color" outfile; less -R outfile +++
works great. Its a bit of a pain to not be able to use an editor to scan the file, but I am happy to be able to get "page breaks" with the color as that's better than setting a window scroll memory to 10K lines (and it seems the script command gives me that anyway as everything goes to the screen first.
Many thanks, Paul
On 7/31/2012 12:22 PM, Dave Mitchell wrote:
On Tue, Jul 31, 2012 at 10:10:22AM -0700, Joe Zeff wrote:
On 07/31/2012 12:45 AM, Ed Greshko wrote:
At the moment, I can't think of what editor would retain the colors. :-(
If it's too long, run it through either more or less.
I think the complete command that would satisfy the OP is:
ls -C --color=always | less -R
Dave:
This also works very well
Many thanks, Paul
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 07/31/2012 08:00 PM, Paul Allen Newell wrote:
On 7/31/2012 4:35 AM, Ed Greshko wrote:
On 07/31/2012 07:12 PM, Mikkel L. Ellertson wrote:
Wouldn't -R work better then -r?
Yes, it would be better.
Ed and Mikkel:
+++ script -c "ls -FR --color" outfile; less -R outfile +++
works great. Its a bit of a pain to not be able to use an editor
to scan the file, but I am happy to be able to get "page breaks" with the color as that's better than setting a window scroll memory to 10K lines (and it seems the script command gives me that anyway as everything goes to the screen first.
Many thanks, Paul
Paul, You may want to look at the search capabilities built into less. (man less). Unless you need to modify the file, less should let you do what you want. Also, you can use ls -FR --color | less -R to get rid of the output to the screen buffer.
Have fun. Mikkel - -- Do not meddle in the affairs of dragons, for thou art crunchy and taste good with Ketchup!
On 7/31/2012 6:24 PM, Mikkel L. Ellertson wrote:
Paul, You may want to look at the search capabilities built into less. (man less). Unless you need to modify the file, less should let you do what you want. Also, you can use ls -FR --color | less -R to get rid of the output to the screen buffer.
Have fun. Mikkel
Mikkel:
Yeah, I think I have underestimated what less can do ... I'll check the man pages.
I want to believe that all I want the editor for is navigation, but I know that occasionally I edit out items I don't care about so I have a file left of "things to work on".
I pretty happy with the two options I got, it makes initial scan for "problems" alot easier.
Thanks, Paul
On 01/08/2012, Mikkel L. Ellertson mellertson@gmail.com wrote:
Also, you can use ls -FR --color | less -R to get rid of the output to the screen buffer.
The -F option of 'less' could be added: ls -FR --color | less -FR
This activates 'less' only if necessary, when there is more data than will fit on one screen. This could then be made into a function, for convenience:
function myfuncname { ls -FR --color | less -FR ; }
After this is done once, just type myfuncname to run the whole thing anywhere, anytime (but only in that shell). Function definitions like this usually go into .bashrc in your home directory so that they are automatically defined in every shell you start.
Also, be aware that the behaviour of less is customisable by setting an environment variable named LESS. I have export LESS="FMRSX#.2" in .bash_profile in my home directory, so this activates -FR without needing to specify it explicitly anywhere.