Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

To count total of specific character in a file and save its value to a variable

$
0
0
Hi all, I have a file that contains characters. How do I get total of spesific character from that file and save the count to a variable for doing for calculation.

data.txt
Code:

1
2
2
2
2
3
3
4
5
6
7
8
5
4
3
4
5
6

i want to get total of 4's character in that file and save it for calculation for axample.

thanks first for your help..

Viewing all articles
Browse latest Browse all 16232

Trending Articles