Linux

Shell script utility to read a file line by line

#!/bin/bash # # Shell script utility to read a file line line version 2 # This is simpler version of readline script # This script also demonstrate how to process data file # line by line and then separate line in fields, so that # you can process it according to your need. # # […]

Read More
Linux

Reverse text content in file

#!/bin/bash # Bash shell script to reverse text file contain i.e. concatenate files and # print on the standard output in reverse. This script also demonstrate how # to use arrays under bash shell script. FILE=”$1″ if [ $# -eq 0 ]; then echo “$(basename $0) – file-name” exit 1 fi textArray[0]=”” # hold text […]

Read More
Scripting

Rename files from upper- to lowercase or vice versa

#!/bin/bash # # Shell script to rename given file names to from uppercase to # lowercase OR lowercase to uppercase FILES=”$1″ ME=”$(basename $0)” # function to display message and exit with given exit code function die(){ echo -e “$1” exit $2 } # exit if no command line argument given [ “$FILES” == “” ] […]

Read More
Linux

RESET MASTER

/var/lib/mysql har blitt over 1,5GB stor så jeg Googlet litt for å finne ut hva som kunne gjøre dette og det viser seg at mysql logger all aktivitet. RESET MASTER sletter logger osv og etter å ha kjørt kommandoen så var /var/lib/mysql bare 222MB. You can delete all binary log files with the RESET MASTER […]

Read More