Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- if [ $# -ne 2 ]
- then
- echo "Usage: $0 <file> <prefix>"
- exit
- fi
- k=0
- s=0
- while read str
- do
- if [ $str = "End" ]
- then
- break
- else
- if [[ "$str" =~ ^$2.* ]]
- then
- echo $str
- k=$(($k+1))
- s=$(($s+${#str}))
- fi
- fi
- done <&0
- if [ -f $1 ]
- then
- echo "$k siruri, suma=$s" > $1
- else
- echo "not a regular file"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement