티스토리 뷰
#!/bin/bash
input=$1
output=$2
rm $output
n=0
while read line; do
comma="${line//[^,]}"
cnt="${#comma}"
echo "Line No. ${n} : ${cnt}" >> $output
n=$((n+1))
done < ${input}
var="text,text,text,text"
res="${var//[^,]}"
echo "$res"
echo "${#res}"
,,,
3
https://stackoverflow.com/questions/16679369/count-occurrences-of-a-char-in-a-string-using-bash
Count occurrences of a char in a string using Bash
I need to count the number of occurrences of a char in a string using Bash. In the following example, when the char is (for example) t, it echos the correct number of occurrences of t in var, but ...
stackoverflow.com
https://linuxhint.com/read_file_line_by_line_bash/
How to read file line by line in Bash script
I am a trainer of web programming courses. I like to write article or tutorial on various IT topics. I have a YouTube channel where many types of tutorials based on Ubuntu, Windows, Word, Excel, WordPress, Magento, Laravel etc. are published: Tutorials4u H
linuxhint.com
'공부' 카테고리의 다른 글
[hive] partition reload (0) | 2023.03.16 |
---|---|
[windows] COPY /b headers.txt+data.txt result.txt (0) | 2023.03.16 |
[sh] sudo systemctl list-units (0) | 2023.03.14 |
[jinja2] {{ asdf|join(", ") }} (0) | 2023.03.14 |
[airflow] variables `{{ var.value.aa }}` (0) | 2023.03.14 |
- Total
- Today
- Yesterday
- 테슬라 리퍼럴 코드
- 모델 Y 레퍼럴
- COUNT
- 테슬라 레퍼럴
- 테슬라 레퍼럴 적용 확인
- 레퍼럴
- 테슬라 리퍼럴 코드 생성
- 개리마커스
- 유투브
- 모델y
- follower
- 어떻게 능력을 보여줄 것인가?
- 테슬라 크레딧 사용
- 할인
- 클루지
- 책그림
- Bot
- 테슬라 추천
- Kluge
- 테슬라
- 테슬라 레퍼럴 코드 확인
- 김달
- 팔로워 수 세기
- 인스타그램
- 테슬라 리퍼럴 코드 혜택
- wlw
- 메디파크 내과 전문의 의학박사 김영수
- 연애학개론
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |