suppose we have a file which contains
34
45
56
77
55
66
54
67
so output shud be like
33
44
55
76
54
65
53
66
suppose we have a file which contains
34
45
56
77
55
66
54
67
so output shud be like
33
44
55
76
54
65
53
66
file_no's content are
34
45
56
77
55
66
54
67
tempfile=file_no
for number in `cat $tempfile`
do
number=$((number-1))
echo $number
done
zsh 4.3.4% cat file
34
45
56
77
55
66
54
67
zsh 4.3.4% eval printf "%d\\\n" $(printf "\$((%d-1)) " $(<file))
33
44
55
76
54
65
53
66
or:
zsh 4.3.4% awk '$1=$1-1' file
33
44
55
76
54
65
53
66
or you can do something like this
for line in `cat $file`
do
line=`expr $line - 1`
echo $line
done
Thanks
Namish
Hey please try this one,
awk ' { printf ("%d\n", $0-1) } ' <<File Name>>