Posts

Showing posts from January 8, 2019

Counting the number of lines between same repeating pattern

Image
Clash Royale CLAN TAG #URR8PPP 0 I have refer this Grep the lines between the occurrence of the same pattern , I don't want to split into file; instead, I want to store it into an array. File count.txt contain: 0 1 2 3 0 1 2 0 1 My script code is: total=$(sed -n $= count.txt) c=0 k=0 lineno=0 var="0" for i in $(cat count.txt); do if ["$i" -eq "$var"] then arr[$((k++))]=c c=0 c=$((c+1)) else c=$((c+1)) if ["$lineno" -eq "$total"] then arr[$((k++))]=c fi fi lineno=$((lineno+1)) done The above logic is tested on C++ launguage which on printing the array shows : 0 4 3 2 Firstly, my script is showing error like line 9: [0: command not found . Secondly, is there any efficient method to store the repeated count in array, like above output? bash awk sed share | improve this question edited 2 days ago Rui F Ribeiro 39.3k 14 79 131 asked Dec 27 '18 at 13:01 Arya Arya 1 ...

Catherine Tanvier

Image
Catherine Tanvier Country (sports)   France Born ( 1965-05-28 ) 28 May 1965 (age 53) Toulouse, France Height 1.74 m (5 ft 8   1 ⁄ 2  in) Plays Right-handed (double-handed backhand) Singles Career record 205–198 Career titles 1 Highest ranking No. 20 (27 September 1984) Grand Slam Singles results Australian Open 4R (1989, 1990, 1991) French Open 4R (1983, 1988) Wimbledon 4R (1985) US Open 2R (1981, 1983, 1984, 1986) Doubles Career record 285–180 Career titles 9 Highest ranking No. 16 (21 December 1986) Grand Slam Doubles results Australian Open QF (1980, 1989) French Open SF (1983) Wimbledon QF (1986) US Open 3R (1984) Grand Slam Mixed Doubles results Australian Open 2R (1988) Wimbledon 3R (1983, 1985) US Open 2R (1984) Catherine (" Cathy ") Tanvier (born 28 May 1965) is a former tennis player from France who was active in the 1980s and the first half of the 1990s. She peaked ...