From 9e957f1bb4ad5d481e9356b4e4b684867dfdd081 Mon Sep 17 00:00:00 2001 From: Snirk9 Date: Thu, 5 Feb 2026 10:44:24 +0000 Subject: [PATCH 1/2] replaced q1.sh from the main repo to mine, and answered it --- q1.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/q1.sh b/q1.sh index f7ac848..df9b2bc 100644 --- a/q1.sh +++ b/q1.sh @@ -1 +1,14 @@ -This is q1 answer +#a +awk '{print NR}' aliceinwonderland.txt | tail -1 + +#b +awk '{ for (i=1; i<=NF; i++) if ($i == "Alice") count++ } END { print count }' aliceinwonderland.txt + +#c +cat aliceinwonderland.txt | tr " " "\n" | awk '{a[$1]++} END {for (k in a) if (a[k]==1) print a[k], k}' + +#d +cat aliceinwonderland.txt | tr " " "\n" | awk '{a[$1]++} END {for (k in a) print a[k], k}' | sort -h | grep -E "[a-zA-Z]" | tail -5 + +#e +echo $(awk '{count=count+length($0)} END {print count} ' aliceinwonderland.txt) / $(awk '{ for (i=1; i<=NF; i++) count++ } END { print count }' aliceinwonderland.txt) | bc -l From 91ffe1f3d25d2c250dd6844ebeb2237a10fbe6d5 Mon Sep 17 00:00:00 2001 From: Snirk9 Date: Thu, 5 Feb 2026 10:44:54 +0000 Subject: [PATCH 2/2] added q2.sh to answer q2 in ex 10 --- q2.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 q2.sh diff --git a/q2.sh b/q2.sh new file mode 100644 index 0000000..f868f73 --- /dev/null +++ b/q2.sh @@ -0,0 +1,14 @@ +#a +sed -n '/Sherlock\|Holmes/p' sherlockholmes.txt | wc -l + +#b +sed 's/Sherlock\|Holmes/snir/g' sherlockholmes.txt | grep -o "snir" | wc -l + +#c +sed -E 's/.{70,}/Long Line/g' sherlockholmes.txt + +#d +sed -E 's/\b[A-Z][a-zA-Z]+\s[A-Z][a-zA-Z]+\b/Snir/g' sherlockholmes.txt + +#e +sed -E 's/\((.+)\)/\[\1\]/g' sherlockholmes.txt