Extract emoticons from text file with shell script and regular expressions

Asked

Viewed 38 times

1

I want to script with Shell script that extracts from a text file emoticons, for example ;), :), :3, :(, xD and also count the emoticons of each sentence

A sentence is declared positive if the sum of the positive emoticons exceeds 2.5 times the sum of the negative emoticons if present, if not the sentence is declared negative, I made that code that counts the amount of positive, but I’m a little confused, please someone could help me finish this script?

file="${1}"

while loop

while IFS= read -r line
x=0
do
    let "x=x+1"

    qtd=$(echo "$line" | sed -r 's/ /\n/g' | grep "POSITIVO" | wc -l)
    echo "SENTENÇA $x \t - POSITIVO - $qtd"
done <"$file"

Example Sentences(Comment_do_twitter.txt):

?RT @justinbiebcr: The bigger the better....if you know what I mean ;)
Listening to the "New Age" station on @SlackerRadio 
I favorited a YouTube video -- Drake and Josh - The Storm "We will rock you" 
i didnt mean knee high I ment in lengt it goes down to my knees ^-^ and is so cute I love it!
I wana see the vid Kyan
if my mom went on for the love of ray J or any reality show i'd bee pissed .
Ok so I just got a deal for my own show "For The Love Of Deez Nuts" go to VH1/deezNuts to apply ....R u here for Deez Nuts???
@Mrhilton1985 Welcome to Twitter xx
@kjbmusic oh yeah... however, I'd still like to be in the midst of it all though... u know...
Can't say I like the new facebook layout. But just posted pics from my Super Bowl week. =)
I need a nice tea-drinking pic for our #Tea Club Membership page - anyone got one they'd be happy for me to use? 
@JonathanRKnight so twitpic it lol, I love Home Depot, love working w/my hands and building things, my dad was in construction
@BarCough it's enough to make you sick, eh? there's nothing sacred anymore
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.