Hi,
How to count number of tabs in a line
Hi,
How to count number of tabs in a line
Try this:
echo "$line" | awk '{print gsub(/\t/,"")}'
or
awk '{print gsub(/\t/,"")}' infile
# cat infile
sasasa dwedwdw dewedwed dwdqwd ddwed ddfwe
# od -c infile | grep -o "\t" | wc -l
6
Hi ygemici, don't you mean:
grep -o "\t" infile | wc -l
Actually I dont mean this..because we dont look the invisible chars in normal text with grep..
sed 's/\t/--TABHERE--/g' infile
sasasa--TABHERE--dwedwdw--TABHERE--dewedwed--TABHERE--dwdqwd--TABHERE--ddwed--TABHERE--ddfwe--TABHERE--