# Question 1

## Remove initial and final spaces before inserting commas
sed -E -e 's/^ +//' -e 's/ +$//' -e 's/ +/,/g' q1input.txt

## Inserting commas, then removing initial/final commas
sed -E -e 's/ +/,/g' -e 's/^,//' -e 's/,$//' q1input.txt

# Question 2

sed -E -e 's!,!</td><td>!g' -e 's!^!<tr><td>!' -e 's!$!</td></tr>!' q2input.csv

# Question 3

sed -E -e 's/^((  )+)/\1\1/g' q3input.py  | less

# Question 3 variant, going from 3- to 4-space indentations

sed -E -e 's/^( +)\1\1/\1\1\1\1/g' q3input.py  | less

# Question 5, but using bit_is_on() instead of func()

sed -E -e 's/bit_is_on\(([^,)]*) *, *([^,)]*)\)/bit_is_on(\2, \1)/g' q5input.py

# Question 7

strings img1.png | grep 'text' | sed -E 's/^.*"text": "([^"]*)".*$/\1/'
strings img2.png | grep 'text' | sed -E 's/^.*"text": "([^"]*)".*$/\1/'
strings img3.png | grep 'text' | sed -E 's/^.*"text": "([^"]*)".*$/\1/'

