Tag: app

Got an android tablet or phone you aren’t using? or are using but feel it can serve other purposes while not doing whatever you are forcing it to do against its will? well check Ultimate server app, a *FREE* app out that turns your android device into a server type of your choice!

Overview

– Add a Dynamic DNS Updater using the local or public IP of your device – Start/Stop servers automatically when connected/disconnected from a specified WIFI network, or on boot, or directly when the app starts – Set a custom name and port per server – No rooted device is needed – Set a WIFI lock, keep the device alive and/or keep the device fully awake (including the screen) – Optionally save all the server data to the sdcard to prevent removal during upgrades – View all IP addresses of your device, including the public IP – Automatically email and clear the log when the maximum amount is reached – Verbose log (filter, email, etc)

SED aka stream editor is a utility app in linux / bsd systems (among others) which allows you to parse text in files based on simple regexp and change them based on its own set of rules.

simple syntax for parsing and replacing text in a file called test.txt that contains the text I love cats and hate dogsn number of times and replace with I love sloths and hate ducks

sed -e 's/cats/sloths/' test.txt
sed -e 's/dogs/ducks/' test.txt

but to make it shorter you can actually add the options to same command.

sed -e 's/cats/sloths/g' -e 's/dogs/ducks/g' test.txt

the problem with above? it will only do so once per line, so if oyu have multiple instances it wont work. so you need to “globalize” this search/replace. note the added g after the words

sed -e 's/dogs/ducks/g' test.txt

what if you only want the replacements to happen on lines 2 – 7?

sed -e '2,7s/dogs/ducks/g' test.txt

How about if you want to only replace on lines begining with the word link? (replace link with any other word you please) and ending in the word pie (again replace pie with whatever)

sed -e '/^link/,/^pie/s/dogs/ducks/g' test.txt

what if your words have the separator / already in them? say in a path like /home/kingpin ? well you can replace the separator with anything arbitrary you choose at the beginning after the s and it will change the separator all throughout the sed command.

sed -e 's;dogs;ducks;g' test.txt

or with / in the words

sed -e 's;/home/kingpin;/home/notkingpin;g' test.txt

Well this is it for now… theres SO much more out there, tye man sed in your CLI to find out more or just google 🙂