Using LINUX commands in App Inventor. Extension

49.- awk

awk is a scripting language which is used for processing or analyzing text files .
We are going to do the examples in this tutorial:
https://www.linuxtechi.com/awk-command-tutorial-with-examples/

shell_awk.aia (12.1 KB)

1 Like

If you have sqlite3 in your /system/bin, you can run sqlite commands. Here are a couple of examples:

  1. Return the contents of a database table or view as a csv format text:

sqlite3 -header -csv /storage/emulated/0/< path/to/database > 'SELECT * FROM < table or view >;'

(remove "-header" if you do not want the column headings, replace items in and including <> for your database and table or view)

  1. Export the contents of a table or view to a csv file:

sqlite3 -header -csv /storage/emulated/0/< path/to/database > 'SELECT * from < table or view >;' > /storage/emulated/0/< path/to/filename >.csv

(this method is not provided by the various sqlite extensions, so a shortcut to extracting data)

I tried doing this with bash scripts but they just didn't want to work for some reason

2 Likes

Good One
How can I connect to a Redis server?
Will you please give me a sample string to connect and get the value?

You would need to have redis-tools installed on the device to even try to connect to a redis server using redis-cli and this extension. You cannot, as far as I know, install redis-tools....

1 Like

How can I Install it? Any link or idea?

1 Like

Sir, I already have a Redis server installed and it contains 7 ports. I have used the Cloud DB components and created all my apps. I want t to use the HSET, HGET commands of Redis as we don’t have in the Cloud DB component. So, I thought some how we have an option to release commands with this extension.

As I said....

You might be able to do something with php, sending commands to a server, and then use shell_exec to send redis commnds?

Please give me a syntax

https://www.php.net/manual/en/function.shell-exec.php

1 Like

I didn't get anything with this command (Firefox, Chrome, Win 7 pro, Galaxy Note8 - Android 9, Nexus5x - Android 8.1). Nothing from curl --version, curl --help etc.
Any clue why?

Probably not installed on your device (it isn't on mine either....)
Check what is with:

ls /system/bin/
1 Like

Yes curl is not there and also some other commands that I'm missing. So what to do?
Does it depend on my adb.exe (I have no clue of that)?

No it is just about the device and what was installed as default by the phone provider.
Worth having a look in some of your other devices?
Need to be rooted to be able to install other packages to the busybox

1 Like

Really useful extension, @Juan_Antonio!

Can we get ping result like this?

KIO4_Terminal.Run
commandLine ping -c 1 google.com

or

ping -c 1 https://www.google.com

1 Like

I meant to say that currently we get result after executing all the command.
Can we get result asynchronously? Like in shell or cmd.

not possible with this extension, this is a workaround:
pingg

1 Like

I am finding on my Android 10 & 11 devices that there is nothing reported back with

ls /system/bin

System command files are there though. If you type:

which ls

you should get back

/system/bin/ls

Thanks Google :wink:

1 Like

Hello i Tried it but nothing happend...must i be rooted to use it ?