fields.awk database

Under development: PCMCIA, wireless, etc.
Message
Author
mcewanw
Posts: 3169
Joined: Thu 16 Aug 2007, 10:48
Contact:

#46 Post by mcewanw »

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: Select all

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/Rx ... kable_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/h ... 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, 23:08, edited 4 times in total.

User avatar
Pete
Posts: 660
Joined: Sun 02 Mar 2014, 18:36

Re: fields2html script

#47 Post by Pete »

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, 09:59, edited 1 time in total.

User avatar
Pete
Posts: 660
Joined: Sun 02 Mar 2014, 18:36

#48 Post by Pete »

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: Select all

http://www.somewebsite.com
or
https://www.anothersite.com
Screenshot below shows your DB with corrected URLs which are clickable.
Attachments
ScreenshotGK(1).jpg
(22.79 KiB) Downloaded 231 times
Last edited by Pete on Sun 26 Jun 2016, 08:58, edited 3 times in total.

User avatar
Pete
Posts: 660
Joined: Sun 02 Mar 2014, 18:36

Re: Differing terminal behavior on fields.awk search outputs

#49 Post by Pete »

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.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#50 Post by greengeek »

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.
Attachments
Clickable_now.jpg
(16.74 KiB) Downloaded 226 times

User avatar
Pete
Posts: 660
Joined: Sun 02 Mar 2014, 18:36

#51 Post by Pete »

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.

cabbie0
Posts: 26
Joined: Thu 23 Jun 2016, 05:19
Location: British Columbia, Canada

Miscellaneous

#52 Post by cabbie0 »

@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 ;)
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

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#53 Post by greengeek »

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.
Attachments
fieldsawk_gg-0.1.pet
(5.82 KiB) Downloaded 231 times

User avatar
Pete
Posts: 660
Joined: Sun 02 Mar 2014, 18:36

#54 Post by Pete »

@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.
Attachments
ScreenshotFgg.jpg
(48.21 KiB) Downloaded 163 times
Last edited by Pete on Sun 26 Jun 2016, 17:45, edited 3 times in total.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#55 Post by greengeek »

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.

User avatar
Pete
Posts: 660
Joined: Sun 02 Mar 2014, 18:36

#56 Post by Pete »

No worries greengeek.
Just after I posted, I downloaded your pet and noticed the /usr/local/bin which is fine.

cabbie0
Posts: 26
Joined: Thu 23 Jun 2016, 05:19
Location: British Columbia, Canada

Running fields.awk in FreeBSD

#57 Post by cabbie0 »

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. :)
Attachments
fields-bold.awk.zip
fields.awk with bold text highlighting feature
Note this will not work in sh or dash shells, only bash.
(10.43 KiB) Downloaded 223 times
fieldsawk_bold.jpg
Fields.awk with bold highlighting feature, running in LXterminal
(47.09 KiB) Downloaded 167 times

User avatar
Pete
Posts: 660
Joined: Sun 02 Mar 2014, 18:36

#58 Post by Pete »

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.

cabbie0
Posts: 26
Joined: Thu 23 Jun 2016, 05:19
Location: British Columbia, Canada

Pet "tarball"

#59 Post by cabbie0 »

@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.

User avatar
Pete
Posts: 660
Joined: Sun 02 Mar 2014, 18:36

#60 Post by Pete »

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

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#61 Post by musher0 »

@cabbie0

I think you forgot to actually zip your fields-bold.awk file. As it is, it's a fake zip.

@all : remove the zip ending and you have the script.

IHTH. BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

cabbie0
Posts: 26
Joined: Thu 23 Jun 2016, 05:19
Location: British Columbia, Canada

Other devices

#62 Post by cabbie0 »

@Pete
I can answer yes for two of those.
Fields.awk will run on a Mac running OSx because I tried it a few years back on a Mac mini.
Who knows if recent shell changes might have nixed that however.

As for tablets, I have fields.awk running on a Samsung Galaxy 7" screen tablet.
This was achieved by installing the ZShaolin terminal emulator app.
( https://play.google.com/store/apps/deta ... olin&hl=en )
You have to copy the executable to /system/bin/
and you have to change the first line to #! system/bin/bash, because that is where their bash executable resides.
However, I have had to use the old system of datafile selection; that is
fields.awk [path_to_datafile]
at which point it works fine.
For some reason the S (data file selection) feature causes error messages.

Also, I'm using Android version 4.4.2 on Model# SM-T230NU and I heard rumors about ZShaolin not running properly anymore on the newer Android versions. I hope that isn't true.
Attachments
fields_on_tablet.jpg
Samsung Galaxy tablet, Android 4.4.2, ZShaolin terminal emulator
(162.3 KiB) Downloaded 266 times

cabbie0
Posts: 26
Joined: Thu 23 Jun 2016, 05:19
Location: British Columbia, Canada

Zip file kerfuffle

#63 Post by cabbie0 »

@all
Sorry about that. Meant to mention that it was a fake zip. Such a small file didn't seem to need actual zipping.

Thank you Christian (musher0) for pointing that out.

@Pete
Thank you for the link to Puppy Linux time line. My, how you've diversified.

User avatar
Pete
Posts: 660
Joined: Sun 02 Mar 2014, 18:36

#64 Post by Pete »

@cabbie0

Thanks for confirming that it will run on MAC and Android.
Let's hope that the rumors are not true.

I have also asked the wife to load Cygwin on her Win 8.1 machine to try it out.
Will report back.

BTW, in case you weren't aware, there is a simple way to take a screenshot on an Android device:
(Don't know if it works on all devices and versions)

================================

Tap the Android Settings button.

Locate the section titled Device and then tap the Motions and gestures entry.

Make sure that Palm swipe to capture is selected (has a check mark).

Now, simply put the side of your hand (the side of your palm) on the right side
of your Galaxy screen and ‘swipe’ it across to the other side.

You’ll hear the camera “snapping

User avatar
Pete
Posts: 660
Joined: Sun 02 Mar 2014, 18:36

#65 Post by Pete »

Getting back to which Terminals can handle URL's, I have only managed to get LXTerminal to work.

However, the URL must have a http:// in front else you get an error even though the cursor does change and it becomes underlined.
Web browsers seem to be quite happy without it.
Attachments
URLinLXTerm.png
(15.52 KiB) Downloaded 251 times
URLinLXTermError.png
(35.67 KiB) Downloaded 246 times

Post Reply