From 0f1ac7bca1d6e41ed219641b25e162a588ccb07b Mon Sep 17 00:00:00 2001 From: Maya Prashker Date: Sun, 25 Jan 2026 10:44:17 +0000 Subject: [PATCH 1/2] added q1.sh --- q1.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/q1.sh b/q1.sh index f7ac848..bd1c8e2 100644 --- a/q1.sh +++ b/q1.sh @@ -1 +1,10 @@ -This is q1 answer +#a +awk '{print NR}' aliceinwonderland.txt | tail -1 +#b +grep -o " Alice " aliceinwonderland.txt | wc -l +#c +grep -E -o "[A-Za-z]+" aliceinwonderland.txt | sort | uniq -c | sort -h | awk '$1 == 1' +#d +grep -E -o " [A-Za-z]+ " aliceinwonderland.txt | sort | uniq -c | sort -rh | head -n 5 +#e +grep -E -o "[A-Za-z]+" aliceinwonderland.txt | awk '{total+=length($0)} END{print total/NR}' From 49b6556c33b368eaca5e1ea69b7d2be08ebbd937 Mon Sep 17 00:00:00 2001 From: Maya Prashker Date: Sun, 25 Jan 2026 10:44:47 +0000 Subject: [PATCH 2/2] added q2.sh --- q2.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 q2.sh diff --git a/q2.sh b/q2.sh new file mode 100644 index 0000000..d1ea2b9 --- /dev/null +++ b/q2.sh @@ -0,0 +1,10 @@ +#a +sed -E -n '/Sherlock|Holmes/p' sherlockholmes.txt | wc -l +#b +sed -E -n '/Sherlock|Holmes/p' sherlockholmes.txt | grep -o -E 'Sherlock|Holmes' | wc -l +#c +awk '{if (length($0)>70) print "Long line"; else print $0}' sherlockholmes.txt +#d +sed -E 's/([[:upper:]]){1}([a-z])+(\s)([[:upper:]]){1}([a-z])+/Maya/g' sherlockholmes.txt +#e +sed 's/(/[/g; s/)/]/g' sherlockholmes.txt