Archive for the ‘Shell Script’ Category
Wednesday, April 11th, 2018
You can use the following command to change Specific string on all files under specific directory:
find /u01/directory -type f | xargs perl -pi~ -e ‘s/oldtext/newtext/g;’
Tested on Linux & AIX
Ref:
https://blogs.oracle.com/rammenon/recursively-replacing-a-string-in-all-files-in-a-directory-linux
Tags: AIX, linux, Recursive, replace, script, string, xargs
Posted in AIX, Linux, Shell Script | No Comments »
Sunday, September 3rd, 2017
The following link containing a quick sheet to start on Shell Script:
shell-quicksheet
The Sheet has the following outline:
Variables
Relational operators
Pattern matching
Functions
Shell math
Test conditions
Flow control
Sample snippets
Special variables
Conditional commands
Trapping signals
Output redirection
Variable substitution
Continue Reading…
Tags: quick, ref, script, sheet, shell
Posted in Shell Script | No Comments »
Sunday, August 20th, 2017
Hello Everybody,
The following lines are a for loop script to display disks info @ AIX System (Disk Name, Disk Unique ID, Disk Size in MB) and of course you can customize the data by add more columns:
Continue Reading…
Tags: AIX, awk, bootinfo, Disks, lscfg, lspv, script, serial, shell
Posted in AIX, Shell Script | No Comments »
Wednesday, October 9th, 2013
some times you transfer files from windows to Linux or UNIX using binary method, you will find some hidden characters on the file, to display these hidden character use commands “cat” with option “vte” see the following examples:
Continue Reading…
Tags: cat, char, hidden, script, shell, vte
Posted in AIX, Linux, Shell Script, Solaris | No Comments »
Tuesday, July 30th, 2013
Hello every body,
i have below a nice script to tell year the year is Leap or NOT.just copy the following line into a new file name it leap.ksh
# Shell program to read any year and find whether leap year or not
# -----------------------------------------------
# Copyright (c) 2005 nixCraft project
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------
# store year
yy=0
isleap="false"
#echo -n "Enter year (yyyy) : "
#read yy
yy=$1
# find out if it is a leap year or not
if [ $((yy % 4)) -ne 0 ] ; then
: # not a leap year : means do nothing and use old value of isleap
elif [ $((yy % 400)) -eq 0 ] ; then
# yes, it's a leap year
isleap="true"
elif [ $((yy % 100)) -eq 0 ] ; then
: # not a leap year do nothing and use old value of isleap
else
# it is a leap year
isleap="true"
fi
if [ "$isleap" == "true" ];
then
echo "YES"
else
echo "NOT"
fi
Continue Reading…
Tags: leap, script, shell
Posted in Shell Script | No Comments »
Sunday, July 28th, 2013
if you are a Shell Scripting Developer and all the time deveolpe Shell Scripts, if course you need to make your System Ring after finished the script or when it needs data from the user.
try this code on AIX
Continue Reading…
Tags: AIX, bell, linux, ring, script, shell
Posted in AIX, Linux, Shell Script | No Comments »
Wednesday, July 24th, 2013
Nice way to separate between your terminals by it’s name not IP Address.
the default way, when you open SSH Terminal using Putty (or any other Communication program like kitty) The IP Address of the server
will be shown on the top of the terminal like the following Image:
Continue Reading…
Tags: kitty, name, putty, Terminal
Posted in Shell Script | No Comments »