Consider a file named "matrix" contaning the following data:
0 1 2 3 4
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
4 5 6 7 8
5 6 7 8 9

#set the cell at 2nd column and 2nd row to 4 and the cell at 3rd column and 3rd row to 9
administrator@ubuntu:~/workspace/bash$ cat matrix | awk 'NR==3{$3=9}NR==2{$2=4}{print}'
0 1 2 3 4
1 4 3 4 5
2 3 9 5 6
3 4 5 6 7
4 5 6 7 8
5 6 7 8 9

administrator@ubuntu:~/workspace/bash$ cat matrix | awk 'NR<=NF{$NR=$NR*$NR}{print}'
0 1 2 3 4
1 4 3 4 5
2 3 16 5 6
3 4 5 36 7
4 5 6 7 64
5 6 7 8 9

# cut the first column of the file
administrator@ubuntu:~/workspace/bash$ cat matrix | cut -d" " -f 2-
1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7
5 6 7 8
6 7 8 9

# cut the first 3 columns of the file and output each number in a line
administrator@ubuntu:~/workspace/bash$ cat matrix | awk '{for(i=4;i<=NF;i++)print $i}'
3
4
4
5
5
6
6
7
7
8
8
9

# cut the last row of the file
administrator@ubuntu:~/workspace/bash$ sed '$d' < matrix
0 1 2 3 4
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
4 5 6 7 8

# cut the last 2 rows of the file
administrator@ubuntu:~/workspace/bash$ sed 'N;$!P;$!D;$d' < matrix
0 1 2 3 4
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7

# cut the 2nd row of the file
administrator@ubuntu:~/workspace/bash$ sed '2d' < matrix
0 1 2 3 4
2 3 4 5 6
3 4 5 6 7
4 5 6 7 8
5 6 7 8 9

# use 2nd column as the key to the 4th column.
#e.g. if a file named "key" contains
# 1
# 2
# 5
administrator@ubuntu:~/workspace/bash$ gawk 'ARGIND==1 {map[$2]=$4;next} {print $1, "-", map[$1]}' matrix key
1 - 3
2 - 4
5 - 7

# suppose matrix is
# 0 1 2 3 4
# 1 2 3 4 5
# 2 3 4 5 6
# 3 4 5 6 7
# 3 4 5 6 7
# 4 5 6 7 8
# 5 6 7 8 9
# count the frequency of the 5th column (adjacent reocurrences only count one) for rows do not contain number "2"
# note how variable last is referenced!!!
administrator@ubuntu:~/workspace/bash$ cat matrix | awk '/2/{last=0;next} last!=$5 {c[$5]++} {last=$5} END {for(i in c){print c[i],i}}'
1 7
1 8
1 9
#For each number i appears on the 5th column, count # of rows that have it on the 5th column (excluding rows that do not contain number "2")
administrator@ubuntu:~/workspace/bash$ cat matrix | awk '/2/{last=0;next} {c[$5]++} END {for(i in c){print c[i],i}}'
2 7
1 8
1 9

#calculate the increase rate of the 5th column
administrator@ubuntu:~/workspace/bash$ cat matrix | awk '{print "last="last,"current="$5,"rate="($5-last)/$5;last=$5}'
last= current=4 rate=1
last=4 current=5 rate=0.2
last=5 current=6 rate=0.166667
last=6 current=7 rate=0.142857
last=7 current=8 rate=0.125
last=8 current=9 rate=0.111111