Hostsfile generator


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
# 1  
Hostsfile generator

Hello

I use a bash script to creating the hosts file /etc/hosts
Quote:
#!/bin/bash
System is Centos7
But there is a bug inside my output and I want to fix this.

My Array looks like this:
Code:
205,IP         111.122.133.20 
205,HOST2      unas           
205,HOST1      unas15533      
205,COMMENT    # UNAS         
775,IP         111.122.133.77 
775,HOST2      wlan           
775,HOST1      15533-wlan     
775,COMMENT    # WLAN Access Point
1015,IP        111.122.133.101
1015,HOST2     rdp1           
1015,HOST1     15533-rdp1     
1015,COMMENT   # RDP-Terminal 1
1025,IP        111.122.133.102
1025,HOST2     rdp2           
1025,HOST1     15533-rdp2     
 1025,COMMENT   # RDP-Terminal 2

The created hosts file looks something like this:
Quote:
# x.x.x.001 - x.x.x.020 ----- Gateway, Switch, Picco und Sicherung
192.168.123.1 123wan wan # Opensystem Gateway
192.168.123.2 123switch1 switch1 # Switch 1
192.168.123.3 123switch2 switch2 # Switch 2
192.168.123.5 123imm1 imm1 # IMM 1
192.168.123.20 unas123 unas # UNAS Sicherung

# x.x.x.41 - x.x.x.50 Server
192.168.123.41 123virtsrv1 virtsrv1 # CentOS

# x.x.x.161 - x.x.x.190 ----- Netzwerkdrucker
192.168.123.161 123mps1 mps1 # Netzwerkdrucker 1
192.168.123.162 123mps2 mps2 # Netzwerkdrucker 2
192.168.123.163 123mps3 mps3 # Netzwerkdrucker 3
192.168.123.164 123mps4 mps4 # Netzwerkdrucker 4

# #x.x.x.191 - x.x.x.199 ----- WPS Drucker und PreisChecker
192.168.123.191 123toschiba1 toschiba1 # Toshiba WPS 1
192.168.123.192 123toschiba2 toschiba2 # Toshiba WPS 2

# 10.168.123.xxx ----- DMZ
10.168.123.2 123rowa rowa # Rowa (DMZ)
I creat the hosts file with this command:
Code:
echo "===================================================="
d=`date +%Y%m%d`
touch "/tmp/hosts.${d}"
IFS=$'\n'
echo "${!ENTRIES[*]}" | sort -t, -k1,1n -k2,2.2r -k2.3 | while read IX; do printf "%-10s\n" ${ENTRIES[$IX]}; done | paste -sd"\t\t\t\n" >> "/tmp/hosts.${d}"
echo "Script finished"
echo "===================================================="

I would like to format the file so that the distances are even (sometimes there is a bigger gap between IP and hosts1, between hosts 1 and hosts 2, ...).
Also, I do not want to use tabs because this causes problems.

Thank you for the help Smilie
# 2  
Quote:
Originally Posted by Marti95
...
But there is a bug inside my output and I want to fix this.
What bug? pls describe / explain.

Quote:
My Array looks like this:
Array used for what?

Quote:
Code:
205,IP         111.122.133.20 
 205,HOST2      unas           
205,HOST1      unas15533      
205,COMMENT    # UNAS         
775,IP         111.122.133.77 
775,HOST2      wlan           
775,HOST1      15533-wlan     
775,COMMENT    # WLAN Access Point
1015,IP        111.122.133.101
1015,HOST2     rdp1           
1015,HOST1     15533-rdp1     
1015,COMMENT   # RDP-Terminal 1
1025,IP        111.122.133.102
1025,HOST2     rdp2           
1025,HOST1     15533-rdp2     
    1025,COMMENT   # RDP-Terminal 2

The element count per leading number seems to vary?


Quote:
The created hosts file looks something like this:
The hosts file doesn't come from the array above?



Quote:
I would like to format the file so that the distances are even
What distances?
# 3  
Quote:
What bug? pls describe / explain.
I dont want to use tabs. Because the hostsfile can't get read correctly with tabs.
Also is the problem that the spaces between [IP] [HOST1] [HOST2] is not the same for each line. Maybe once is [IP] (2 spaces) [Host1] next line [IP] (4 spaces) [Host1]

Quote:
The element count per leading number seems to vary?
yes the Index is vary, and createt by ip address to sort it easy.


Quote:
The hosts file doesn't come from the array above?
It comes from the array, but the array I quoted has diffrent text.

Should I post the hole script?
# 4  
I attachet my script.

Its written in german.
Quesiton for yes and no: j=yes n=no

Quote:
Ist es eine Bähler/Dropa? [j/n]
use "j" (yes)

It generates you a hosts file.

Code:
#!/bin/bash
# ==============================================================================================
# Script um Hostfiles zu erstellen
# ==============================================================================================
# @Since   07.03.2019
# @Author  Roman Buehler
# ==============================================================================================
# CHANGELOG
# 07.03.2019 - Version 1.0.0 RBU
# ==============================================================================================


# =====================
# ====== DECLARE ======
# =====================
declare -A ENTRIES
declare -A ENTRY
declare -x kunnr
declare -x ip3
declare -i baehler


# =======================
# ====== FUNCTIONS ======
# =======================

# Funktion welche eine Ja/Nein frage stellt und @makeentry aufruft.
# Input: $1=HOST; $2=IP; $3=COMMENT; $4=LINE ABOVE (Comment line);
function askyn() {
	while true; do
		read -p "${3} (${1})? [j/n]: " yn
		case $yn in
			[Jj]* ) makeentry "$1" "$2" "$3" "$4" "$5"; return 1;;
			[Nn]* ) return 0;;
			* ) echo "Bitte mit Ja [j] oder Nein [n] beantworten.";;
		esac
	done
}

# Funktion welche eine nummerische abfrage stellt und @makeentry aufruft.
# Input: $1=HOST; $2=IP; $3=COMMENT; $4=LINE ABOVE (Comment line);
function asknum() {
	while true; do
		read -p "Anzahl ${3/\{n\}/}(${1})?: " num
		re='^[0-9]+$'
		if [[ $num =~ $re ]] ; then
			# Es ist eine Zahl
			if [[ "$num" -ge "1" ]]; then
				# >= 1
				ip=$2
				comment=$3
				# Comment Line
				if [ ! -z "$4" ] 
				then
					# Titel Linie Generieren
					addcomment "$ip" "$4"			
				fi
				# Entry
				for (( i=1; i<=$num; i++ ))
				do
					makeentry "${1}${i}" "${ip}" "${comment/\{n\}/$i}" "" "$5" # Kommentar {n} wird durch aktuelle Zahl ersetzt.
					((ip++))
				done
				break;
			else 
				break;
			fi
		else
			# Es ist keine Zahl
			echo "Bitte eine Zahl angeben";
		fi	
	done
	return 1
}

# Funktion welche einen Host eintrag in ein Array schreibt.
# Input: $1=HOST; $2=IP; $3=COMMENT; $4=LINE ABOVE (Comment line); $5=Host1 & Host2 umkehren (1=umkehren)
# Array: INDEX, $ip, kunnmr-host, host, comment, line above (Title line)
function makeentry() {
	# IP - KNNRHOST - HOST - COMMENT
	 
	host=${1,,}; # lowercase
	
	# Comment Line
	if [ ! -z "$4" ] 
	then
		# Titel Linie Generieren
		addcomment "$2" "$4"			
	fi
	
	# IP Address
	ENTRY["IP"]="$ip3.$2"
	if [[ "$5" == "1" ]]; then
		if [[ "$baehler" == "1" ]]
		then
			# Bähler Host
			ENTRY["HOST2"]="$kunnum$host"
		else
			ENTRY["HOST2"]="$kunnum-$host"
		fi
		ENTRY["HOST1"]="$host"
	else 
		if [[ "$baehler" == "1" ]]
		then
			# Bähler Host
			ENTRY["HOST1"]="$kunnum$host"
		else
			ENTRY["HOST1"]="$kunnum-$host"
		fi
		ENTRY["HOST2"]="$host"
	fi
	ENTRY["COMMENT"]="# $3"
	for key in "${!ENTRY[@]}"; do
		ENTRIES[$2"5",$key]=${ENTRY[$key]} # INDEX={IP}5
	done
	#echo ${ENTRY["IP"]}"     "${ENTRY["HOST1"]}"   "${ENTRY["HOST2"]}"    "${ENTRY["COMMENT"]};
	return 1
}

# Funktion welche einen Kommentar als Host eintrag erstellt
# Input: $1=ip; $2=COMMENT;
function addcomment() {
		# Titel Linie Generieren
		ENTRY["IP"]="# $2"
		ENTRY["HOST1"]=""
		ENTRY["HOST2"]=""
		ENTRY["COMMENT"]=""
		for key in "${!ENTRY[@]}"; do
		  ENTRIES[$1"4",$key]=${ENTRY[$key]} # INDEX={IP}4
		done
		# Zeile darüber = leere Zeile
		ENTRY["IP"]=" "
		for key in "${!ENTRY[@]}"; do
		  ENTRIES[$1"0",$key]=${ENTRY[$key]} # INDEX={IP}0
		done	
}

# Funktion um IP-Adresse zu pruefen (Nur 3 Segmente)
function valid_ip()
{
    local  ip=$1
    local  stat=1

    if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
        OIFS=$IFS
        IFS='.'
        ip=($ip)
        IFS=$OIFS
        [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \
            && ${ip[2]} -le 255 ]]
        stat=$?
    fi
    return $stat
}


# ==================
# ====== MAIN ======
# ==================

# Welcome Message
echo "===================================================="
echo "     Willkommen beim Hostfile Generator (Hosti)     "
echo "===================================================="


# Kndr NR oder Baehler ident
# Check if Baehler
while true; do
	read -p "Ist es eine Bähler/Dropa? [j/n]: " yn
	case $yn in
		[Jj]* ) 
			baehler="1"
			while true; do
				read -p "Bitte DBD Ident/Filalnummer angeben (z.B. 01, 123, 234, ...) Wiki #4428...: " input_baehler
				re='^[0-9]+$'
				if [[ "$input_baehler" =~ $re ]]
				then
					if [[ $input_baehler -le 9 ]] 
					then
						kunnum="0$input_baehler"
					else
						kunnum=$input_baehler
					fi
					break;
				else
					echo "Bitte Zahlen angeben!"
				fi
			done
		break;;
		[Nn]* ) 
			baehler="0"
			while true; do
			read -p "Bitte Kundennummer angeben (z.B. 15533)...: " input_knr
				re='^[0-9]+$'
				if [[ "$input_knr" =~ $re ]] || [[ "$input_knr" -eq 5 ]]
				then
					kunnum=$input_knr
					break;
				else 
					#Kundennummer nicht OK (5 Stellen & Zahl)
					echo "Kundennummer ist nicht korrekt! (Muss 5 stellig sein)"
				fi
			done
		break;;
		* ) echo "Bitte mit Ja [j] oder Nein [n] beantworten.";;
	esac
done

# Kundennr OK
# Kundennr Splitten & IP Bereich generieren
if [[ baehler -eq "1" ]]
then
	seg12="192.168"
	if [[ $input_baehler -le 9 ]] 
	then
		seg3="10$input_baehler"
	elif [[ $input_baehler -le 99 ]] 
	then
		seg3="1$input_baehler"
	else 
		seg3="$input_baehler"
	fi
	ip3="$seg12.$seg3"
else 
	seg1="10"
	seg2=${input_knr:0:3}
	seg3=${input_knr:3:2}
	ip3="$seg1.$seg2.$seg3"
fi
echo "IP Vorschlag: $ip3.xxx"
while true; do
	read -p "Vorschlag in ordnung? [j/n]: " yn
	case $yn in
		[Jj]* ) break;;
		[Nn]* ) 
			while true; do
				read -p "Bitte IP Adresse angeben (3 Segmente xxx.xxx.xxx): " input_ip
				if valid_ip $input_ip; then
					ip3="$input_ip"
					break
				else
					echo "IP Adresse ist nicht korrekt."
				fi
			done
			break;;
		* ) echo "Bitte mit Ja [j] oder Nein [n] beantworten.";;
	esac
done



# Propharma Server abfrage
# 1. Proxmox
# 2. CentOS
# 3. Physisch mit IMM
# 4. Physisch ohne IMM
addcomment "41" "x.x.x.41 - x.x.x.50 Server" # Überschrift PP Server
makeentry "propharma" "50" "ProPharma Server";
while true; do
	echo "=== PROPHARMA SERVER ==="
	maxcpp=4 # Maximale anzahl auswahlmöglichkeiten für PP Server
	echo -e "1. CentOS\n2. Proxmox\n3. Physisch mit IMM\n4. Physisch ohne IMM"
	read -p "Bitte wählen [1-$maxcpp]: " input_pp
	re='^[0-9]+$'
	if [[ "$input_pp" =~ $re ]] && [[ "$input_pp" -le "$maxcpp" ]]
	then
		case $input_pp in
			[1]* )
				makeentry "imm1" "5" "IMM 1 (ProPharma)"
				makeentry "virtsrv1" "41" "CentOS (ProPharma)"
				break;;
			[2]* ) 
				makeentry "imm1" "5" "IMM 1 (ProPharma)"
				makeentry "proxmox1" "41" "Proxmox 1 (ProPharma)"
				break;;				
			[3]*)
				makeentry "imm1" "5" "IMM 1 (ProPharma)"
				break;;
			[4]*) break;;
			* ) 
				echo "Fehler."
				break;;
		esac
		break
	else
		echo "Bitte zwischen 1 und $maxcpp wählen!"
	fi
done



# RDP Server abfrage
# 1. Proxmox 
# 2. CentOS
# 3. Physisch mit IMM
# 4. Physisch ohne IMM
# 5. Kein RDP Server
while true; do
	echo "=== RDP SERVER ==="
	maxcrdp=5 # Maximale anzahl auswahlmöglichkeiten für RDP Server
	echo -e "1. Proxmox\n2. CentOS\n3. Physisch mit IMM\n4. Physisch ohne IMM\n5. Kein RDP Server"
	read -p "Bitte wählen [1-$maxcrdp]: " input_rdp
	re='^[0-9]+$'
	if [[ "$input_rdp" =~ $re ]] && [[ "$input_rdp" -le "$maxcrdp" ]]
	then
		case $input_rdp in
			[1]* ) 
				makeentry "imm2" "6" "IMM 2 (RDP-Server)"
				makeentry "proxmox2" "42" "Proxmox 2 (RDP-Server)"
				rdpserver=1
				break;;
			[2]* )
				makeentry "imm2" "6" "IMM 2 (RDP-Server)"
				makeentry "virtsrv2" "42" "CentOS (RDP-Server)" 
				rdpserver=1
				break;;
			[3]*)
				makeentry "imm2" "6" "IMM 2 (RDP-Server)"
				rdpserver=1
				break;;
			[4]*) 
				rdpserver=1
				break;;
			[5]*) 
				rdpserver=0
				break;;
			* ) 
				echo "Fehler."
				break;;
		esac
		break
	else
		echo "Bitte zwischen 1 und $maxcrdp wählen!"
	fi
done

if [[ rdpserver -eq "1" ]]; then
	makeentry "rdp" "100" "RDP-Server"
	if [[ baehler -eq "1" ]]; then
		addcomment "100" "x.x.x.100 - x.x.x.100 RDP Server" # Überschrift RDP Server
		asknum "rdp" "131" "RDP-Terminal {n}" "x.x.x.131 - x.x.x.155 RDP-Terminal" "1" # RDP Platine
	else
		addcomment "100" "x.x.x.100 - x.x.x.120 RDP Server & Stationen" # Überschrift RDP Server
		asknum "rdp" "101" "RDP-Terminal {n}" "" "1" # RDP Platine
	fi
fi


# UNAS
# !!! Spezial Fall !!!
while true; do
	read -p "UNAS? [j/n]" yn
	case $yn in
		[Jj]* ) 
		ENTRY["IP"]="$ip3.20"
		ENTRY["HOST1"]="unas$kunnum"
		ENTRY["HOST2"]="unas"
		ENTRY["COMMENT"]="# UNAS Sicherung"
		for key in "${!ENTRY[@]}"; do
			ENTRIES["205",$key]=${ENTRY[$key]} # INDEX=205
		done
		break;;
		[Nn]* ) break;;
		* ) echo "Bitte mit Ja [j] oder Nein [n] beantworten.";;
	esac
done

if [[ baehler -eq "1" ]]; then
# Bähler
	makeentry "wan" "1" "Opensystem Gateway" "x.x.x.001 - x.x.x.020 ----- Gateway, Switch, Picco und Sicherung" # Firewall
	asknum "switch" "2" "Switch {n}" #Switch
	askyn "picco" "11" "Picco-Link Basisstation" # Picco

	asknum "bon" "21" "Bondrucker {n}" "x.x.x.021 - x.x.x.035 ----- Bondrucker" # Bondrucker
	
	askyn "rez" "51" "Rezeptscanner-PC" "x.x.x.051 ----- Rezeptscanner-PC" # Rez PC
	
	asknum "mps" "161" "Netzwerkdrucker {n}" "x.x.x.161 - x.x.x.190 ----- Netzwerkdrucker" #Drucker
	
	asknum "toschiba" "191" "Toshiba WPS {n}" "#x.x.x.191 - x.x.x.199 ----- WPS Drucker und PreisChecker" # WPS Drucker
	asknum "prschk" "195" "Preischecker {n}" # Preischecker
	
	# Bähler Rowa (DMZ)
	# !!! Spezial Fall !!!
	while true; do
		read -p "Rowa? [j/n]" yn
		case $yn in
			[Jj]* ) 
			addcomment "999" "10.168.${seg3}.xxx ----- DMZ" # Überschrift DMZ
			ENTRY["IP"]="10.168.${seg3}.2"
			ENTRY["HOST1"]="${kunnum}rowa"
			ENTRY["HOST2"]="rowa"
			ENTRY["COMMENT"]="# Rowa (DMZ)"
			for key in "${!ENTRY[@]}"; do
				ENTRIES["9995",$key]=${ENTRY[$key]} # INDEX=9995 (zu letzt)
			done
			break;;
			[Nn]* ) break;;
			* ) echo "Bitte mit Ja [j] oder Nein [n] beantworten.";;
		esac
	done

	
else
# Normal
	asknum "switch" "21" "Switch {n}" "X.X.X.21 - X.X.X.24 Switches" #Switch
	addcomment "75" "x.x.x.75 - x.x.x.80 Firewall und WLAN"
	
	# Firewall abfrage
	# 1. USG
	# 2. Watchguard
	# 3. Fortigate
	# 4. Zywall
	while true; do
		echo "=== FIREWALL ==="
		maxcfw=4 # Maximale anzahl auswahl möglichkeiten für Firewall
		echo -e "1. Fortigate\n2. USG\n3. Watchguard\n4. Zywall"
		read -p "Bitte wählen [1-$maxcfw]: " input_fw
		re='^[0-9]+$'
		if [[ "$input_fw" =~ $re ]] && [[ "$input_fw" -le "$maxcfw" ]]
		then
			case $input_fw in
				[1]* ) 
					makeentry "forti" "75" "Fortigate E30"
					break;;
				[2]* )
					makeentry "usg" "75" "Firewall USG20"
					break;;
				[3]*)
					makeentry "adsl" "75" "Firewall Watchguard"
					break;;
				[4]*) 
					makeentry "adsl" "75" "Firewall Zywall"
					break;;
				* ) 
					echo "Fehler."
					break;;
			esac
			break
		else
			echo "Bitte zwischen 1 und $maxcfw wählen!"
		fi
	done
	
	# Firewall
	asknum "at" "81" "Axel Terminal {n}" "x.x.x.80 - x.x.x.99 AXEL-Ansi Platinen" "1" # Axel Platine
	asknum "mps" "141" "Netzwerkdrucker {n}" "x.x.x.141 - x.x.x.160 Netzwerkdrucker" # Drucker
	asknum "prschk" "25" "Preischecker {n}" "x.x.x.25 - x.x.x.29 Preischecker" # Preischecker
	asknum "bon" "191" "Bondrucker {n}" "x.x.x.191 - x.x.x.199 Bondrucker" # Bondrucker
	askyn "picco" "162" "Picco-Link Basisstation" #Picco
	# Kein Unterschied ob DBD oder Normal
	askyn "wlan" "77" "WLAN Access Point" # Wlan
	askyn "rowa" "161" "Rowa" "x.x.x.161 - x.x.x.161 Rowa" # Rowa
	asknum "pc" "51" "PC-Arbeitsplatz {n}" "x.x.x.51 - x.x.x.70 PC-Arbeitsplatz" # Anzahl PC's
	asknum "vid" "181" "Raspberry Pi {n}" "x.x.x.181 - x.x.x.190 Raspberry Pi" # Raspberry Pi
	
fi


# Hosts File generieren
echo "===================================================="
d=`date +%Y%m%d`
touch "/tmp/hosts.${d}"
IFS=$'\n'
echo "${!ENTRIES[*]}" | sort -t, -k1,1n -k2,2.2r -k2.3 | while read IX; do printf "%-10s\n" ${ENTRIES[$IX]}; done | paste -sd"\t\t\t\n" >> "/tmp/hosts.${d}"
echo "Script finished"
echo -e "\n\nDie Hosts-Datei wurde geschrieben: \e[32m/tmp/hosts.${d}\e[0m\nBitte durch kopieren nach /etc/hosts aktivieren!\n\n"
echo "===================================================="
exit 0

This User Gave Thanks to Marti95 For This Post:
# 5  
man hosts:
Quote:
Fields of the entry are separated by any number of blanks and/or tab characters.


Guessing ENTRIES is your array, how far would this get you:
Code:
for IN in $(sort -u <<< $(echo "${!ENTRIES[*]}" | tr ',' '\n'))
  do    [ ! "${IN/[A-Z]}" = "$IN" ] && break
        printf "%s %s %s %s\n" "${ENTRIES[$IN",IP"]}" "${ENTRIES[$IN",HOST1"]}" "${ENTRIES[$IN",HOST2"]}" "${ENTRIES[$IN",COMMENT"]}"
  done; 
111.122.133.101 15533-rdp1 rdp1 
111.122.133.102 15533-rdp2 rdp2 # RDP-Terminal 2
111.122.133.20 unas15533 unas # UNAS
111.122.133.77 15533-wlan wlan # WLAN Access Point

# 6  
Quote:
Originally Posted by RudiC
man hosts:



Guessing ENTRIES is your array, how far would this get you:
Code:
for IN in $(sort -u <<< $(echo "${!ENTRIES[*]}" | tr ',' '\n'))
  do    [ ! "${IN/[A-Z]}" = "$IN" ] && break
        printf "%s %s %s %s\n" "${ENTRIES[$IN",IP"]}" "${ENTRIES[$IN",HOST1"]}" "${ENTRIES[$IN",HOST2"]}" "${ENTRIES[$IN",COMMENT"]}"
  done; 
111.122.133.101 15533-rdp1 rdp1 
111.122.133.102 15533-rdp2 rdp2 # RDP-Terminal 2
111.122.133.20 unas15533 unas # UNAS
111.122.133.77 15533-wlan wlan # WLAN Access Point

Thanks for your answer. But this does not work. It gives me nothing back.
# 7  
Quote:
Originally Posted by Marti95
Thanks for your answer. But this does not work ...
It does, as you can see in my post.
- What's your result with the array shown in post #1?
- What exactly does your array look like (index / element)?
- What's yoour bash version?
Run the code with the -x (--xtrace) option set and post the output.
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #787
Difficulty: Medium
In early 2019, Bill Gates responded to the public backlash against billionaires by demanding a lower estate tax.
True or False?

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Generator script

Hello again unix.com people, I need your help again. I'm currently need a script that will generate ip ranges... lets say from 64.1.1.1 to 74.255.255.255 and the output should be like this: 64.1.1.2 64.1.1.3 ............. ............. 74.255.255.254 74.255.255.255 (line-by-line) ... (7 Replies)
Discussion started by: galford
7 Replies

2. Shell Programming and Scripting

Sequence generator

Thanks Guys This really helped (5 Replies)
Discussion started by: robert89
5 Replies

3. Shell Programming and Scripting

time generator

Hi experts, I'd like to generate the table/file containing: number of milliseconds elapsed since midnight till midnight. It should contain 5 columns (hours minutes seconds milliseconds): Table will have theoretically 86 400 000 rows. My question is , is there somewhere the file or source... (7 Replies)
Discussion started by: hernand
7 Replies

4. What is on Your Mind?

Barcode Generator

QR Code Generator (0 Replies)
Discussion started by: Neo
0 Replies

5. Shell Programming and Scripting

Random Sentence Generator

Hi, I need to create a table with random sentences. I need lines that are upto 1000 characters in lenght. I need a random sentence generator that will create sentences and output it to a text file. The sentences should be of lenght varying from 1 to 1000. Does anyone know how this can be... (7 Replies)
Discussion started by: kaushys
7 Replies

6. Shell Programming and Scripting

Range generator

Dear All, I have a sorted file like 1 2 3 8 9 10 45 46 47 78 The output will be range like 1 3 8 10 45 47 78 78 (9 Replies)
Discussion started by: saifurshaon
9 Replies

7. Shell Programming and Scripting

How to compare result lpstat with hostsfile

Hi there all, I got a long list of printers installed and a longer list of printers in my hosts file. In the hosts file I got a even longer list of printers in the hosts file I got the IP adress of all printers next to the printer name. How can I get a script working to get the printers... (0 Replies)
Discussion started by: draco
0 Replies

8. UNIX for Dummies Questions & Answers

date generator

Is there a command to generate the unix date that is in theshadow file?>? (2 Replies)
Discussion started by: BG_JrAdmin
2 Replies

9. Cybersecurity

Password Generator

I need a great Password Generator program. I looked at a few of them, but none of them seemed to be what I wanted. So I have decided to write my own. (That's the cool thing about being a programmer....I always get what I want in software :) ) Do you have any password generators that you... (13 Replies)
Discussion started by: Perderabo
13 Replies

Featured Tech Videos