Thursday, July 8, 2010
Wednesday, July 7, 2010
Partition alignment
http://blogs.sun.com/dlutz/entry/partition_alignment_guidelines_for_unified
Very good and detailed article regarding storage partition alignment. Non-aligned partitions could make a very significant impact on the performance, and there is explanation why. And the guidline how to cound and align partitions as a bonus.
Very good and detailed article regarding storage partition alignment. Non-aligned partitions could make a very significant impact on the performance, and there is explanation why. And the guidline how to cound and align partitions as a bonus.
Friday, May 7, 2010
Monday, April 19, 2010
The procedure to get numbers of installed patches on solaris
getpatchlevel () # This subprocedure generates the list of installed pathes and makes # a readable output declare -a patch # The array contains the all installed patches numbers count=0 # The amount of array member for i in `showrev -p | cut -c1-70 | awk '{print $2}'` do patch[$count]=`echo $i` let "count = $count+1" done #Make the readable output: 6 patch per string k=0 while [ $k -lt ${#patch[@]} ] do echo ${patch[$k]} ${patch[$k+1]} ${patch[$k+2]} ${patch[$k+3]} ${patch[$k+4]} ${patch[$k+5]} let "k=$k+6" done }
Thursday, March 18, 2010
Tuesday, March 16, 2010
How to get the latest file from the directory
#
way 1:
$ ls -lrt | awk '{ f=$NF }; END{ print f }'
#
#The above awk is to print the last argument of the last line
#
way 2:
$ ls -t1 | head -n
REFERENCE: bash - parameter expansion, i.e. http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_02
outputs the file base and extension respectively ("data" and "txt").
${variable#pattern} is similar to "echo $variable |sed 's/^pattern//'"
but the pattern matching isn't "greedy" unless you double the #.
Likewise ${variable%pattern} is similar to
"echo $variable | sed 's/pattern$//'"
way 1:
$ ls -lrt | awk '{ f=$NF }; END{ print f }'
#
#The above awk is to print the last argument of the last line
#
way 2:
$ ls -t1 | head -n
REFERENCE: bash - parameter expansion, i.e. http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_02
file=data.txt echo ${file%.*} echo ${file#*.}
outputs the file base and extension respectively ("data" and "txt").
${variable#pattern} is similar to "echo $variable |sed 's/^pattern//'"
but the pattern matching isn't "greedy" unless you double the #.
Likewise ${variable%pattern} is similar to
"echo $variable | sed 's/pattern$//'"
Thursday, March 4, 2010
Read file writting strings into array
declare -a ARRAY
count=0
while read line; do
echo $line
ARRAY[$count]=$line
let count=count+1
echo $count
done < ips.tmp
echo ${ARRAY[1]}
echo ${#ARRAY[@]}
count=0
while read line; do
echo $line
ARRAY[$count]=$line
let count=count+1
echo $count
done < ips.tmp
echo ${ARRAY[1]}
echo ${#ARRAY[@]}
Wednesday, March 3, 2010
Friday, February 12, 2010
Wednesday, February 10, 2010
How to find out the symlink source (without readlink)
$ cat basher
#!/usr/local/bin/bash
string="lrwxr-xr-x 1 mmmm users 66 Sep 4 09:58 LINK_SEND -> /apps/aaa/home/mmmm/FFFFF/Apps/RRRRRR/unit_tests/TARGET_SEND"
echo $string
string=${string##* }
echo $string
string=${string%/*}
echo $string
exit 0
$
$
$ ./basher
lrwxr-xr-x 1 mmmm users 66 Sep 4 09:58 LINK_SEND -> /apps/aaa/home/mmmm/FFFFF/Apps/RRRRRR/unit_tests/TARGET_SEND
/apps/aaa/home/mmmm/FFFFF/Apps/RRRRRR/unit_tests/TARGET_SEND
/apps/aaa/home/mmmm/FFFFF/Apps/RRRRRR/unit_tests
$
source
#!/usr/local/bin/bash
string="lrwxr-xr-x 1 mmmm users 66 Sep 4 09:58 LINK_SEND -> /apps/aaa/home/mmmm/FFFFF/Apps/RRRRRR/unit_tests/TARGET_SEND"
echo $string
string=${string##* }
echo $string
string=${string%/*}
echo $string
exit 0
$
$
$ ./basher
lrwxr-xr-x 1 mmmm users 66 Sep 4 09:58 LINK_SEND -> /apps/aaa/home/mmmm/FFFFF/Apps/RRRRRR/unit_tests/TARGET_SEND
/apps/aaa/home/mmmm/FFFFF/Apps/RRRRRR/unit_tests/TARGET_SEND
/apps/aaa/home/mmmm/FFFFF/Apps/RRRRRR/unit_tests
$
source
Subscribe to:
Posts (Atom)