Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 30 Oct 2014, 15:14
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
less 4.58, Powerful CLI Text Viewer
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 3 Posts_count   Goto page: 1, 2, 3 Next
Author Message
musher0


Joined: 04 Jan 2009
Posts: 4268
Location: Gatineau (Qc), Canada

PostPosted: Fri 13 Jan 2012, 04:20    Post_subject:  less 4.58, Powerful CLI Text Viewer
Sub_title: Can use piping and be called from right-click on any text
 

~~~~~~~~~~~~~~~~~
Edit, Dec. 20, 2013. For latest compile of less version 458, please go to:
http://murga-linux.com/puppy/viewtopic.php?p=745241&sort=lastpost#745241
(I've deleted the version 451 that was attached to this initial post.)
Thanks.
~~~~~~~~~~~~~~~~~
Update, April 25, 2013: less-458 is out. See message at bottom of page.

Hello, all!
Here is less 4.51, dated July 2012, compiled from source. This pet includes lesspipe and numerous right-click accesses. More compact size than v. 4-44 obtained by stripping and upx'ing of executable. This one also replaces outright the "defaulttextviewer" file.

From the less viewer, if you need to edit a file, press "V" and the file will load in your text editor. You will be brought back to the less viewer upon closing your editor.

Enjoy! Smile

/////////////////

Rationale:
The less included by default in Puppy is the cut-down version integrated in busybox. It does the job, barely. If you need more sophisticated viewing capacity, then you need this full version of less.

For example I've replaced Puppy's defaulttextviewer with less-4.51, with no regrets. It loads the text extremely fast, it allows you to view text -- or binary material, which leafpad, nicodedit or even geany do not load at all.

This pet also comprises (minimal) docs created by the compilation. Look for "less.hlp" under /usr/local/share/doc and view it with... less ?? Smile

(You can also view the help file of less while reading any other text, simply by typing "h". After you've consulted less's help, type "q" to return to reading your initial text.)

The default text viewer has been replaced with this script:

Code:
#!/bin/sh
# /usr/local/bin/defaulttextviewer
####
urxvt -fn "xft:Aerial Mono:pixelsize=13" -fg "#D8FDDB" -bg "#786849" -sr +st +tcw -bc -T "Aperçu de \"$@\"" -n "Aperçu de \"$@\"" -tr -tint black -sh 57 -bd firebrick4 -g 84x25+320+24 -cr white -b 4 -e less-444 -B -J -m -N -~ "$1"
# exec nicoedit "$@"
# or perhaps
# exec leafpad "$@"


The above uses the transparent and xft font features of urxvt to make viewing under less "softer on the eyes". It also displays the name of the file being viewed in the title bar.

As an aside, I've got the docs in a series of 8 jpg panels for easy consultation. If there's a request, I'll make them available here also.

Have a great day!

P.S. A screenshot is included.
viewing-a-script-with-less.jpg
 Description   
 Filesize   20.25 KB
 Viewed   932 Time(s)

viewing-a-script-with-less.jpg


_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)

Edited_times_total
Back to top
View user's profile Send_private_message Visit_website 
GustavoYz


Joined: 07 Jul 2010
Posts: 897
Location: .ar

PostPosted: Wed 18 Jan 2012, 02:15    Post_subject:  

Thanks, it works like a charm.
I've to tweak some things in order to make puppy less (busybox one) work with man pages, but this full less has no issues.
Thanks again.

EDIT: I've replaced the original less symlink for an equal symlink pointing to less-444, no regrets.

_________________

Back to top
View user's profile Send_private_message 
musher0


Joined: 04 Jan 2009
Posts: 4268
Location: Gatineau (Qc), Canada

PostPosted: Thu 19 Jan 2012, 03:20    Post_subject:  

Hi, Gustavo.

My pleasure!

BFN.

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send_private_message Visit_website 
musher0


Joined: 04 Jan 2009
Posts: 4268
Location: Gatineau (Qc), Canada

PostPosted: Thu 19 Jan 2012, 03:37    Post_subject:  

Confused by the less commands?

Here's a little script that will launch the less help at the same time as the document you want to view with less.

You can link this script as a context command in ~/.config/rox-sourceforge.net/SendTo/text_plain, for example, or any other of the directories there with text_something.

The help text will appear black on white, and the consulted text as white on black. No fancy transparency.

Enjoy!

Code:

#!/bin/ash
# /~/my-applications/bin/less-avec-aide.sh
####
urxvt -sr -g 82x24+40+40 -e less-444 --help &
urxvt -rv -sr -g 110x28 -e less-444 -B -J -m -N -~ "$@" &


Here is a screenshot.
less-avec-aide.jpg
 Description   
 Filesize   63.89 KB
 Viewed   836 Time(s)

less-avec-aide.jpg


_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send_private_message Visit_website 
musher0


Joined: 04 Jan 2009
Posts: 4268
Location: Gatineau (Qc), Canada

PostPosted: Fri 31 Aug 2012, 05:10    Post_subject:  

Hello, all.

A new version of less is available. Please see first post for download.

Enjoy!

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send_private_message Visit_website 
GustavoYz


Joined: 07 Jul 2010
Posts: 897
Location: .ar

PostPosted: Mon 03 Sep 2012, 14:21    Post_subject:  

@musher0: Thanks, check this out:
http://www.greenwoodsoftware.com/less/faq.html#tricks

_________________

Back to top
View user's profile Send_private_message 
GustavoYz


Joined: 07 Jul 2010
Posts: 897
Location: .ar

PostPosted: Tue 13 Nov 2012, 15:13    Post_subject:  

Arrow You can set options into a system variable called `$LESS`, so the next time is executed, less will use those (useful when "piping").

For example, to see a script with sintax highlights, I often use pygmentize + less on this way (I use a custom bash function with this in reality):
Code:
pygmentize -l perl regex.pl | less

But, if $LESS has no '-R', it won't show colors.

The workaround is easy: add on the .bashrc somthing like this:
Code:
LESS=`$LESS -r`

This way you won't loose any previous options set and add support for colors on situations like above.

My $LESS variable (bashrc adds '-r -Qai'):
Code:
-M -r -Qai


Arrow Also, less alloud you to have color on man pages (some puppies have `man`).
Check this: http://pastebin.com/SbaR33Pt

_________________

Back to top
View user's profile Send_private_message 
musher0


Joined: 04 Jan 2009
Posts: 4268
Location: Gatineau (Qc), Canada

PostPosted: Tue 13 Nov 2012, 16:31    Post_subject:  

Thanks for those tips, Gustavo!
_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send_private_message Visit_website 
musher0


Joined: 04 Jan 2009
Posts: 4268
Location: Gatineau (Qc), Canada

PostPosted: Thu 25 Apr 2013, 21:21    Post_subject:  

less-458 is just out.
Enjoy!

musher0

PS. Almost forgot:
* if this is your first install of less, you can ignore this note.
* if you already have less installed, remove all previous "less"-related files (such as lesskey, lessopen) with pfind before you install this version. The executables of this version are entirely in /usr/bin, and we don't want interference from earlier versions, right ? Smile
In particular remove any previous versions you may have in /usr/local/bin or /root/my-applications/bin.
Also, it's not fresh to my mind, but I believe BK has a "less" linked to busybox in /bin in some Puppies. Never remove BK stuff from a Puppy; simply rename it to "less-NO", or something like that. The new 458 full version will then have full precedence, and there will be no confusion in the system.
Thanks.
less-458.pet
Description  Known to work on wheezypup 3.5.2.5
pet

 Download 
Filename  less-458.pet 
Filesize  121.31 KB 
Downloaded  329 Time(s) 

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)

Edited_time_total
Back to top
View user's profile Send_private_message Visit_website 
tallboy


Joined: 21 Sep 2010
Posts: 448
Location: Oslo, Norway

PostPosted: Fri 26 Apr 2013, 01:51    Post_subject:  

Hi musher0
I downloaded less_458 to my LupuPlus_5.2.8. As you mentioned, the existing /usr/bin/less was a link to busybox.

Less only flashed on the screen for a fraction of a second when I tried it.

Code:
# less my-documents/growisofs.txt
less: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory


tallboy

_________________
True freedom is a live Puppy on a multisession CD/DVD.
Back to top
View user's profile Send_private_message 
musher0


Joined: 04 Jan 2009
Posts: 4268
Location: Gatineau (Qc), Canada

PostPosted: Fri 26 Apr 2013, 10:16    Post_subject:  

Hi, tallboy.

Ah ? I compiled this version in wheezy 3.5.2.5. Strange...

But it's normal, in a way, because less needs "food", it does indeed sort of flash and close if it does not have any text to show.

Re-reading your message, I see that you did give it "food". Ok, I'll do another compile on lupu 5.28 specifically.

musher0

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send_private_message Visit_website 
musher0


Joined: 04 Jan 2009
Posts: 4268
Location: Gatineau (Qc), Canada

PostPosted: Fri 26 Apr 2013, 10:17    Post_subject:  

To test "less" :

Does the following show in a console window or just flashes?
Code:
echo beebabelooba > /tmp/bebop.txt;urxvt -e less -~ /tmp/bebop.txt
# Or any other *.txt file, of course. Or
#
# urxvt -e less --help
# if this last one, type G to go to the end of the help file, and
# small-case g to come back to top, to see if it reacts properly.

If the text shows, it works, obviously. Smile

musher0

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)

Edited_time_total
Back to top
View user's profile Send_private_message Visit_website 
musher0


Joined: 04 Jan 2009
Posts: 4268
Location: Gatineau (Qc), Canada

PostPosted: Fri 26 Apr 2013, 10:52    Post_subject:  

@tallboy and others who might be experiencing library problems with the wheezypup build of less above:

please try this one, compiled on Small Business Pup (SBP) by e_mattis, a derivative of lupu 5.28.

Tests were ok on my lupu. Reports appreciated if not on your machine.

The less-458 version and the libtinfo.so.5.7 library are presented separately. You'll need both for less-458 to work on lupu 5.28.

Enjoy.

musher0

Note. The attached libtinfo library pet was extracted from this package: http://pkgs.org/centos-6-rhel-6/centos-rhel-i386/ncurses-libs-5.7-3.20090208.el6.i686.rpm/download/.
less-458lupu2.pet
Description  less-458 for lupu 5.28; you'll also need the libtinfo library, below.
pet

 Download 
Filename  less-458lupu2.pet 
Filesize  121.59 KB 
Downloaded  299 Time(s) 
libtinfo.so-5.7.pet
Description  partial ncurses library needed by less on lupu 5.28 Puppies.
pet

 Download 
Filename  libtinfo.so-5.7.pet 
Filesize  45.13 KB 
Downloaded  301 Time(s) 

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)

Edited_time_total
Back to top
View user's profile Send_private_message Visit_website 
tallboy


Joined: 21 Sep 2010
Posts: 448
Location: Oslo, Norway

PostPosted: Fri 26 Apr 2013, 21:15    Post_subject:  

Hi musher0.
The /root/my-applications/bin/ directory containing 4 scripts in the original less_458.pet package, is not present in the less_458lupu version.

Will there be any problems if I just copy the scripts into /my-applications/bin? Any hardcoding with references?

tallboy

_________________
True freedom is a live Puppy on a multisession CD/DVD.
Back to top
View user's profile Send_private_message 
musher0


Joined: 04 Jan 2009
Posts: 4268
Location: Gatineau (Qc), Canada

PostPosted: Sat 27 Apr 2013, 00:09    Post_subject:  

tallboy wrote:
Hi musher0.
The /root/my-applications/bin/ directory containing 4 scripts in the original less_458.pet package, is not present in the less_458lupu version.

Will there be any problems if I just copy the scripts into /my-applications/bin? Any hardcoding with references?

tallboy


Hi, tallboy.

Chucks... Sad
Thanks for telling me.
No, no problem at all with your suggestion. Smile Just with my focus...

So I redid the pet for lupu. See above.

BFN.

musher0

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send_private_message Visit_website 
Display_posts:   Sort by:   
Page 1 of 3 Posts_count   Goto page: 1, 2, 3 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0901s ][ Queries: 13 (0.0078s) ][ GZIP on ]