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 14 Dec 2017, 21:07
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
fields.awk database
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 4 of 7 [99 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, 7 Next
Author Message
mcewanw

Joined: 16 Aug 2007
Posts: 3194
Location: New Zealand

PostPosted: Sun 26 Jun 2016, 04:12    Post subject:  

Note: you can open underlined url links displayed in lxterminal by holding Ctrl key whilst left-clicking on the link if you have xdg-open on your system. To get xdg-open functionality in XenialDog, I first had to install the small xdg-utils package using:

Code:
apt-get install xdg-utils


Also, you can apparently open links in urxvt if you first undertake the setup instructions as given here (I haven't tried this) Again seems to rely on xdg-open:

https://wiki.archlinux.org/index.php/Rxvt-unicode#Clickable_URLs

EDIT: Apparently there is a way to enable clipboard support in xterm and clickable url links too (albeit complex triple click...), but again I've not tried this. Find the info in following:

https://lukas.zapletalovi.com/2013/07/hidden-gems-of-xterm.html

William

EDIT2: I've since installed sakura version 3.3.4 on XenialDog and it also now has an Open Link option on right-click. I didn't try it prior to installing xdg-utils, but I expect it needs the xdg-open facility provided by that too. EDIT3: It doesn't seem to need xdg-utils afterall (I tried it without).

Last edited by mcewanw on Sun 26 Jun 2016, 19:08; edited 4 times in total
Back to top
View user's profile Send private message Visit poster's website 
Pete


Joined: 02 Mar 2014
Posts: 675

PostPosted: Sun 26 Jun 2016, 04:27    Post subject: Re: fields2html script  

cabbie0 wrote:
Hi,

Congratulations Pete, that html conversion script seems to work fine in the fields.awk mod.
I like the approach of keeping the mods simple by calling the an outside script (such as fields2html or addcol) from within fields.awk, in order to keep the database script itself as true to the original as possible while still adding functionality.
This also seems in keeping with the basic Unix philosophy.

I have a question regarding your suggested placement of the fields2html script.
You recommend /usr/sbin but a regular user shouldn't be able to activate a script in /usr/sbin. Are you running fields.awk as root?
For a regular user I'd place the script in /usr/local/bin. That's what I did and it seemed to work fine.

Cheers


Hi cabbie0

Glad it's working well in other distros too.
As regards /usr/sbin versus /usr/local/bin, most people using Puppy run as root by default, however if you prefer /usr/local/bin and it works then it's fine too.

BTW as regards my mods, you can easily find them by searching for <pete_mod_start> which always precedes them.

Last edited by Pete on Sun 26 Jun 2016, 05:59; edited 1 time in total
Back to top
View user's profile Send private message 
Pete


Joined: 02 Mar 2014
Posts: 675

PostPosted: Sun 26 Jun 2016, 04:31    Post subject:  

greengeek wrote:
Hi Pete, I just gave this a try and it gave me the correct output (and asked me if i wanted the browser opened) but the urls do not appear as underlined. Do you think that might be something to do with the way my browser is configured?


No, your URLs don't have // after the http: part.

They should be:

Code:

http://www.somewebsite.com
or
https://www.anothersite.com


Screenshot below shows your DB with corrected URLs which are clickable.
ScreenshotGK(1).jpg
 Description   
 Filesize   22.79 KB
 Viewed   174 Time(s)

ScreenshotGK(1).jpg


Last edited by Pete on Sun 26 Jun 2016, 04:58; edited 3 times in total
Back to top
View user's profile Send private message 
Pete


Joined: 02 Mar 2014
Posts: 675

PostPosted: Sun 26 Jun 2016, 04:34    Post subject: Re: Differing terminal behavior on fields.awk search outputs  

cabbie0 wrote:
Hi,

Regarding my previous post indicating that links in a fields.awk search output should be "clickable" in some terminals but not others:


Nice list, will download all the text and pics and make a pdf document and post here.
It will come in handy as a quick reference of clickable links in different terminals.

@mcewanw

Great info too, will include it in the pdf as well.
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 4745
Location: Republic of Novo Zelande

PostPosted: Sun 26 Jun 2016, 05:14    Post subject:  

Pete wrote:
No, your URLs don't have // after the http: part.
Oh yes. Sorry. Corrected now but I get quite a different display format. Any idea what I'm doing differently to you? It's fine this way but just wondered why the difference.
Clickable_now.jpg
 Description   
 Filesize   16.74 KB
 Viewed   161 Time(s)

Clickable_now.jpg

Back to top
View user's profile Send private message 
Pete


Joined: 02 Mar 2014
Posts: 675

PostPosted: Sun 26 Jun 2016, 05:29    Post subject:  

Hi greengeek

The difference is that I'm using fields.awk to generate the html automatically from a search and you are parsing the "raw" database file thru fields2html.
(I'm assuming you are using the latest fields.awk and fields2html and you have placed fields2html in /usr/sbin).

Either works as you have seen but you get different layouts.
This can actually be rather useful depending on how you want the output formatted.
Back to top
View user's profile Send private message 
cabbie0

Joined: 23 Jun 2016
Posts: 22
Location: British Columbia, Canada

PostPosted: Sun 26 Jun 2016, 13:09    Post subject: Miscellaneous  

@mcewanw
Hi William.
Interesting that Roxterm is another terminal example which has the link-opening option.
I tried it on Devuan and it works as you describe. It has a slightly different look from the standard dark terminals; nice.
Also, I think the reason you are seeing normal functionality without gawk installed is your symlink /usr/bin/awk -> /usr/bin/mawk.
Mawk has the extra functionality needed as does gawk.

Also very interesting regarding the CTRL-click trick for launching a link displayed in LXterminal. Ha!
I tried it with Xfce4-terminal and sakura, but it only worked for LXterminal.
Had the xdg-utils installed from something else apparently...


@Pete
Ok I wasn't aware that running as root was default in Puppy Linux. That explains the /usr/sbin location.
Obviously another preference thing Wink
And yes I noticed your use of tags (<pete_mod_start> .... <pete_mod_end>) to mark your code changes.
I like that; good documentation technique.

Cheers,
Ian
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 4745
Location: Republic of Novo Zelande

PostPosted: Sun 26 Jun 2016, 13:23    Post subject:  

I have attached a pet which creates a menu item for starting fields.awk and incorporates the modifications that I like so far. Seems really functional for me and I hope someone else finds it useful too.

This is not an officially sanctioned pet - just my testing phase. Comments appreciated.

Changes as follows:

- Incorporated Ian Forsyth's modification to allow automatic selection of the active database file whenever a new database file is created (instead of having the extra step of manual selection)
- Incorporated Pete's modification to allow .html file output as well as .txt file output (and offers to open browser)
- Changed Pete's mod slightly so that file output appears in /root instead of "/Desktop" directory which is not present in my Slacko derivative.
- Includes Pete's fields2html script.
- Changed wording of the question in "read_from" section asking user to supply name of output file. Wanted to prompt "no suffix required"
- Added a .desktop file placing fields.awk in Business menu (requires mini-modules.xpm icon which is already in Slacko)
- Added a wrapper script (fieldstart) alongside fields.awk and placed both in /usr/local/bin as per Ian's preferred location.

Note: I did not use the same method as Pete eg: <pete_mod_start> .... <pete_mod_end> to highlight my mods as I have occasionally noticed in the past that if I put extra lines in the wrong place it can upset some functionality (might have been in the middle of GTK tables or something that I did not understand at the time) - I didn't trust myself to get such tags in the right place so I have noted my changes in the blurb at the top of the script.

Hope it's ok to make these changes Ian - it is common in Puppyland to load extra programmes via pet and it can help other users' testing and troubleshooting too. I have used the suffix _gg to indicate that this is not an official pet - just my own version for testing. Let me know if you are not happy with anything here and I can take it down.
fieldsawk_gg-0.1.pet
Description 
pet

 Download 
Filename  fieldsawk_gg-0.1.pet 
Filesize  5.82 KB 
Downloaded  72 Time(s) 
Back to top
View user's profile Send private message 
Pete


Joined: 02 Mar 2014
Posts: 675

PostPosted: Sun 26 Jun 2016, 13:34    Post subject:  

@greengeek

Great, thanks for the pet, will make things much easier for others.
Does your pet copy fields2html to /usr/sbin as well?.

@cabbie0

A .pet is a Puppy Linux thing (I suppose equivalent to Debian's .deb).
Pets are actually tar.gzip files so you can change it to .tgz to view the contents but I doubt very much it will work in your distro as it has Puppy specific things like menu entries and such.
Screenshot attached.
ScreenshotFgg.jpg
 Description   
 Filesize   48.21 KB
 Viewed   105 Time(s)

ScreenshotFgg.jpg


Last edited by Pete on Sun 26 Jun 2016, 13:45; edited 3 times in total
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 4745
Location: Republic of Novo Zelande

PostPosted: Sun 26 Jun 2016, 13:41    Post subject:  

Pete wrote:
Does your pet copy fields2html to /usr/sbin as well?.
No, at this stage I have left it alongside fields.awk in /usr/local/bin as that was Ian's preferred location and I hoped it was sensible to keep them all together.

I understand that may potentially cause issues with "path" but I don't know what is "standard" across the puppy range so I just tried it this way and it seems to work. Only tried with Slacko so far though.
Back to top
View user's profile Send private message 
Pete


Joined: 02 Mar 2014
Posts: 675

PostPosted: Sun 26 Jun 2016, 13:44    Post subject:  

No worries greengeek.
Just after I posted, I downloaded your pet and noticed the /usr/local/bin which is fine.
Back to top
View user's profile Send private message 
cabbie0

Joined: 23 Jun 2016
Posts: 22
Location: British Columbia, Canada

PostPosted: Sun 26 Jun 2016, 14:02    Post subject: Running fields.awk in FreeBSD  

Hi guys,

Just a note that recently I did some experimenting with FreeBSD (an alternate unix clone for home computers) in response to concerns over the migration to systemd in most of the Linux distros, including my preferred Debian.
I installed FreeBSD on two older laptops [and Acer Aspire (Intel) and a HP G61 (AMD)] as well as on a separate hard-drive in my current desktop (ASUS motherboard).
In each case I found that fields.awk would run fine, so long as I selected the bash shell specifically.
This underscored the fact that which shell you use is also important.
In FreeBSD, the default shell is not bash, but rather sh, or sometimes csh.
Actually only csh is truly problematic. Fields.awk won't run in it at all.
In sh, or dash, it will run okay except for the "bold text" feature.

In summary, if you do find yourselves using another unix-like system (even a non-Linux one), you will likely still be able to use fields.awk. Smile
fields-bold.awk.zip
Description  fields.awk with bold text highlighting feature
Note this will not work in sh or dash shells, only bash.
zip

 Download 
Filename  fields-bold.awk.zip 
Filesize  10.43 KB 
Downloaded  69 Time(s) 
fieldsawk_bold.jpg
 Description   Fields.awk with bold highlighting feature, running in LXterminal
 Filesize   47.09 KB
 Viewed   105 Time(s)

fieldsawk_bold.jpg

Back to top
View user's profile Send private message 
Pete


Joined: 02 Mar 2014
Posts: 675

PostPosted: Sun 26 Jun 2016, 14:13    Post subject:  

That is indeed interesting info cabbie0, many thanks.
I wonder if fields.awk will also run on:

1) a MAC, they have a weird version of awk or gawk or mawk or what ever it is they have.

2) Windows (under Cygwin)

3) A raspberry Pie, although they seem to also have a weird awk

and what would be really handy is to be able to run fields.awk on a rooted phone/tablet.
Back to top
View user's profile Send private message 
cabbie0

Joined: 23 Jun 2016
Posts: 22
Location: British Columbia, Canada

PostPosted: Sun 26 Jun 2016, 14:27    Post subject: Pet "tarball"  

@greengeek
No worries. I have no objections to any of this. Sounds awesome.
So you are using Slackware?

@Pete
Thank you for explaining what a .pet is. I was wondering about that.

Regarding /usr/local/bin for system-available executables:
Seems this should not be necessary for anyone using Puppy Linux if you are indeed all running bash as root by default.
That is, if path issues arise then your /usr/sbin default might be preferable.
But for anyone on an alternate distro operating by default as regular users with non-root privileges, files placed in /usr/sbin won't be seen as available unless they specifically log in as root or use su or sudo to launch fields.awk.
Back to top
View user's profile Send private message 
Pete


Joined: 02 Mar 2014
Posts: 675

PostPosted: Sun 26 Jun 2016, 14:38    Post subject:  

cabbie0

Puppies are a bit of a mixed breed.
There is Slacko which is based on Slackware, then there is DebianDog, no explanation needed there and there are even some Puppies based on Ubuntu.
There could be others, not sure.
Then of course there are 32 and 64 bit version of some Puppies.

The link below should give you a better picture:

http://puppylinux.com/family-tree.html
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 4 of 7 [99 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, 7 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0902s ][ Queries: 14 (0.0048s) ][ GZIP on ]