For the love of technology


awk remove paragraph with matching string and script

Sed is a stream editor, you give it a file and it outputs it, redirecting the output helps if you want to save it to a file. I had a couple thousand print queues entries in a file with the name of the queue some information about it and then a carriage return that separates them from each other. A simple grep would not work because grep -v would only remove the name of the queue while I needed to remove the name of the queue and the information that was associated with it.

Automate user permission setup

I had a bunch of home directories that I just created. So now I wanted to set the permissions for each home directory quickly and easily, so it only made sense to automate the process. The echo commands are not necessary but very helpful when debugging a issue. This example assumes that you the server is connected to a NIS directory server. Please note that you can not use UID or GIUD as variables because they are reserved variables.

using bash shell to create mulitipule directories at the same time

There are a few other way to make multiple directory’s quickly and easily, but this is my favorite. mkdir {direcotyone,directorytwo,directorythree,directoryfour} $ ls -l drwxrwxr-x. 2 bab bab 4096 Jun 27 16:13 direcotyone drwxrwxr-x. 2 bab bab 4096 Jun 27 16:13 directoryfour drwxrwxr-x. 2 bab bab 4096 Jun 27 16:13 directorythree drwxrwxr-x. 2 bab bab 4096 Jun 27 16:13 directorytwo

Red Hat linux 6 password aging polocies

To modify your password aging policies you want to modify your /etc/login.defs file. This is what a standard file looks like before modification. # Please note that the parameters in this configuration file control the # behavior of the tools from the shadow-utils component. None of these # tools uses the PAM mechanism, and the utilities that use PAM (such as the # passwd command) should therefore be configured elsewhere. Refer to # /etc/pam.d/system-auth for more information.

Order and identify varables using Bash

Here is a short scrip that I made to take a bunch of variables and, check if it is a number or letter then put them in order. #!/bin/bash VARABLES=1 1 e 1 f 1 g 1 h 1 i 3 n 1 o 1 r 1 s 3 t 4 x 1 ALPHANUMERICALLY=`echo $VARABLES |grep -o .|sort -n` echo the varables have been sortedd for i in $ALPHANUMERICALLY; do