Wednesday, November 4, 2020

Unix Bash Shell Script

..

my_string="A-B"
echo "Input: $my_string"
IFS='-' read -ra my_array <<< "$my_string"
len=${#my_array[@]}
for (( i=0; i<$len; i++ )); do
up=$(($i % 2))
#echo $up
if [ $up -eq 0 ]
then
echo "1. ${my_array[i]} = Cat 1"
elif [ $up -eq 1 ]
then
echo "2. ${my_array[i]} = Cat 2"
fi
done

..

$ ./cuba.sh
Input: A-B
1. A = Cat 1
2. B = Cat 2
$

Tuesday, November 3, 2020

VBA

VBA

Sub mula()
With Sheets("s1")
.Range("A1").AutoFilter Field:=2, Criteria1:="x"
With .AutoFilter.Range
With .Range("A1").Resize(.Rows.Count, 3)
With .SpecialCells(xlCellTypeVisible).EntireRow
.Copy
With Sheets.Add(after:=Sheets(Sheets.Count))
.Name = "Task XYZ"
.Paste
.[A1].Select
End With
With Sheets.Add(after:=Sheets(Sheets.Count))
.Name = "Group JKL"
.Paste
.[A1].Select
End With
End With
End With
.Range("a1").Offset(1).Resize(.Rows.Count - 1, 3).SpecialCells(xlCellTypeVisible).EntireRow.Delete
.AutoFilter
End With
End With
End Sub


sub test
with sheets("s1").cells(1).currentregion
.autofilter 2,"x"
.copy sheets("task xyz").cells(1)
.offset(1).entirerow.delete
.autofilter
end with
end sub

Related post:

Related Posts with Thumbnails