#!/bin/bash # Shell program to count # Vowels, blank spaces, characters, number of line and symbols # A, E, I, O, U # -------------------------------------------------------------------- # This is a free shell script under GNU GPL version 2.0 or above # Copyright (C) 2005 nixCraft project. # Feedback/comment/suggestions : http://cyberciti.biz/fb/ # ------------------------------------------------------------------------- # This script is part of nixCraft shell script collection (NSSC) # Visit http://bash.cyberciti.biz/ for more information. # ------------------------------------------------------------------------- file=$1 v=0 if [ $# -ne 1 ] then echo "$0 fileName" exit 1 fi if [ ! -f $file ] then echo "$file not a file" exit 2 fi # read vowels exec 3<&0 while read -n 1 c do l="$(echo $c | tr '[A-Z]' '[a-z]')" [ "$l" == "a" -o "$l" == "e" -o "$l" == "i" -o "$l" == "o" -o "$l" == "u" ] && (( v++ )) || : done < $file echo "Vowles : $v" echo "Characters : $(cat $file | wc -c)" echo "Blank lines : $(grep -c '^$' $file)" echo "Lines : $(cat $file|wc -l )"
Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our email newsletter to make sure you don't miss a single tip/tricks.
- Download Script
- Email this to a friend
- Printable version
- Rss Feed
{ 0 comments… add one now }