Commit 0cdcd63c authored by Roshan Rabinarayan's avatar Roshan Rabinarayan

added solution to q2

parent 13489b37
#!/bin/sh
#converting whitespaces to new line in temp file
sed -e 's/[\t ]\+/\n/g' -e 's/https/\nhttps/g' $1 >temp
#saving all urls
sed -n '/https\:\/\/www\.cse\.iitb\.ac\.in[/][~][^ ]\+/p' temp >url
#removing all urls from inputfile
sed -i -e 's/http[s]\?\:\/\/[^ ]\+/ /g' -e 's/[^ ]\+[.]\(com\|in\|org\|net\|co\|us\|edu\|gov\)[^ ]\?/ /g' $1
sed -i -e 's/[\t ]\+/ /g' $1
rm temp
\ No newline at end of file
rm -f url
./q2.sh testcase/input/input1
diff -Z testcase/output/output1 url > result
if [[ -s result ]];
then
echo failed
else
echo passed
fi
rm result
diff -Z testcase/input/input1 testcase/input/input1_cleaned > result
if [[ -s result ]];
then
echo failed
else
echo passed
fi
rm result
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment