A Shell script is preferred over a Perl script for this request.
From time to time I need to block a spam, so instead of going to the directory
& edit a file & save it, I would like to automate this a bit with a Shell script.
This script's requirements:
a) cd /folderA
b) make a backup of current file ie
cp -p access_sender access_sender.ddmmyyyy
where ddmmyyyy is the day, month, year (in digits)
c) prompt for the offending/spam email address I wish to block & store into a variable ie
Pls enter spam address to block: <this is where I'll key in the email address, eg: email@example.com>
d) use awk or nawk or sed to insert the email address entered into
line 3 of access_sender plus a TAB followed by the text REJECT. Eg:
Note: Lines 1 & 2 will stay while the former line 3, 4 onwards will get pushed down 1 line
Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.
I have been running these systems for a few years now and I am just very happy with them. I just wanted to share the manual that I have created for upgrades and other things. Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Java performance on Solaris - Managing CPUs
There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".
In a multithreaded…
Learn how to get help with Linux/Unix bash shell commands.
Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell.
Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…