# on 18-Oct-2018 (Thu)

#### Flashcard 3415977889036

Question
In regular expressions, using grep, search for all lines that begin with the word "The", in file test.txt
grep '^The' test.txt
^^ note the use of "^", also accaptable is: grep ' *^The' test.txt, this is to cover leading whitespace

status measured difficulty not learned 37% [default] 0
5. Regular Expressions
and sometimes you would like to match a line that begins or ends with a certain string. The ^ character specifies the beginning of a line, and the $character the end of the line. For example, <span>^The matches all lines that start with a The , and hack$ matches all lines that end with hack , and '^ *The.*hack *$' matches all lines that begin with The and end with hack , even if there #### Flashcard 3419976371468 Question In Linux, write a simple bash script that print the numbers from 1 to 4 out to the stdout in a loop (to demonstrate your knowledge of while loop). Answer #!/bin/bash n=1 while [$n -le 4 ]
do
​​​​​​​    echo $n n =$[n+1]
done
​​​​​​​

status measured difficulty not learned 37% [default] 0
7. Shell Scripting