Browse Source

feat(file-researcher): add subject, test and solution for the exercise file-researcher

pull/1649/head
miguel 2 years ago committed by MSilva95
parent
commit
5d6875d0a8
  1. 127
      sh/tests/file-researcher/facts.txt
  2. 28
      sh/tests/file-researcher_test.sh
  3. 1
      sh/tests/solutions/file-researcher.sh
  4. 45
      subjects/devops/file-researcher/README.md

127
sh/tests/file-researcher/facts.txt

@ -0,0 +1,127 @@
Indonesia consists only of islands - 13,667 total
During World War II, the very first bomb dropped on Berlin by the Allies killed the only elephant in the Berlin Zoo
People who ride on roller coasters have a higher chance of having a blood clot in the brain
The tallest freestanding sculpture in the world is Chief Crazy Horse in South Dakota, USA
Marie Curie, the Nobel prize winning scientist who discovered radium, died of radiation poisoning
898 tornadoes were recorded to have occurred in the United States in the year 2000.
The word Popcorn is derived from the middle English word "poppe," which means "explosive sound"
The food that is digested in your stomach is called "chyme."
Alcohol beverages have all 13 minerals necessary for human life
The sentence "The quick brown fox jumps over the lazy dog." uses every letter in the alphabet. (Developed by Western Union to Test telex/twxcommunications)
The word housekeeping was invented by Shakespeare
The only two days of the year in which there are no professional sports games (MLB, NBA, NHL, or NFL) are the day before and the day after theMajorLeague All-Star Game.
In the great fire of London in 1666 half of London was burnt down but only 6 people were injured
Lack of sleep can affect your immune system and reduce your ability to fight infections
All dogs are the descendant of the wolf. These wolves lived in eastern Asia about 15,000 years ago
It is not possible to tickle yourself. The cerebellum, a part of the brain, warns the rest of the brain that you are about to tickle yourself. Since your brain knows this, it ignores the resulting sensation
Parma ham is only Parma ham if it is made in the Parma region of Italy. The British chain supermarket Asda, made and packaged its own "Parma ham" and was successfully sued by the real Parma ham people (Parma Ham Trade Association)
With winds of 50 miles per hour, The Statue of Liberty sways three inches and the torch sways five inches
A famous bullfighter, Lagarijo, killed 4,867 bulls in the 19th century.
Police detectives have used snapping turtles to help them locate dead bodies
In most advertisements, including newspapers, the time displayed on a watch is 10:10
The national sport of Japan is sumo wrestling
The early occurrence of a fetus yawning is at eleven weeks after conception
In a month, a fingernail grows an eighth of an inch
Edward VIII did not officially become the King of England as he abdicated the throne to marry an American divorcee
The book "Little Red Riding Hood" was banned in 1990 by two school districts in California. They did this because in the book there was a picture of a basket that had a bottle of wine in it
The reason why golf balls have dimples on them is because it helps in the ball to move a farther distance by reducing drag
Americans consume the most peanut butter in the world
Celtic warriors sometimes fought their battles naked, their bodies dyed blue from head to toe
To make butter more attractive in color, carrot juice was used by people in the Middle Ages
Early hockey games allowed as many as 30 players a side on the ice
Most fleas do not live past a year old
It takes seven to ten days to make a jelly belly jellybean
Some asteroids have other asteroids orbiting them
Maine is the only state whose name is just one syllable
The male praying mantis cannot copulate while its head is attached to its body. The female initiates sex by ripping the males head off
There is enough concrete in the Hoover Dam to pave a two lane highway from San Francisco to New York
Americans on the average eat 18 acres of pizza every day
Every 238 years, the orbits of Neptune and Pluto change making Neptune at times the farthest planet from the sun
There is a certain species of kangaroo that is only 2.5 centimeters long when it is born
In a lifetime, the average house cat spends approximately 10,950 hours purring
The real name of Toto the dog in "The Wizard Of Oz" was Terry
Stannous fluoride, which is the cavity fighter found in toothpaste is made from recycled tin
It takes 12 honeybees to make one teaspoon of honey
Thomas Watson, who was the chairman of IBM in 1943 predicted that their would probably only be a world market for five computers.
The largest hamburger cooked in the world weighed in at 6,040 pounds
The first lighthouse was in Alexandria in 290 B.C
Heinz first started making ketchup in 1876 and the recipe has remained the same ever since
The largest wedding chapel in Las Vegas is the Viva Las Vegas Chapel, which can seat 100 people
The most popular name for a pet in the United States is Max
Spiral staircases in medieval castles are running clockwise. This is because all knights used to be right-handed. When the intruding army would climb the stairs they would not be able to use their right hand which was holding the sword because of the difficulties of climbing the stairs. Left-handed knights would have had no troubles, except left-handed people could never become knights because it was assumed that they were descendants of the devil
The largest shopping mall in the world is the West Edmonton Mall located in Edmonton, Alberta, Canada
The CN Tower located in Toronto, Ontario Canada took a total construction time of 40 months to complete at an original cost of $63 million
The 20th president of the United States, James Garfield, was able to write Greek with one hand and Latin with the other at the same time
The country of Andorra has a zero percent unemployment rate
In Los Angeles, there are fewer people than there are automobiles
A woman has approximately 4.5 litres of blood in her body, while men have 5.6 litres
In India, pickled ginger, minced mutton and a cottage cheese like substance are popular pizza toppings
Oral-B were the first toothbrushes to go to the moon when they were aboard the Apollo 11 mission
A maple tree is usually tapped when the tree is at least 45 years old and has a diameter of 12 inches
In 1998, a law passed in the U.S. state of Virginia allows drivers to keep their road kill, as long as they report it within 12 hours. updated
A language becomes extinct in this world every two weeks
An acre of trees can remove about 13 tons of dust and gases every year from the surrounding environment
The decomposition point of Olive Oil is 220 degrees Celsius
Ten radishes only contain eight calories
Annually a thousand people are killed by scorpions in Mexico
Every year, 100 million sharks are killed by people
Tug of war was an Olympic event from 1900-1920
Of all the countries, Brazil has the most plant species, with over 56,000
One female mouse can produce up to 100 babies a year
Impotence is grounds for divorce in 26 U.S. states
Women who are romance novel readers are reported to make love 74% more often with their partners than women who do not read romance novels.
The average lifespan of a human taste bud is ten days
The monogram "RR" for Rolls-Royce has never been altered, except for when Sir Henry Royce passed away in 1933. Then it was changed from red to black.
People with darker skin will not wrinkle as fast as people with lighter skin
Fido means faithful in Latin
Pebbles cereal was actually named after the shape of the cereal and not the Pebbles Flintstone character
A group of kangaroos is called a mob
Cat's urine glows under a blacklight.
Every three seconds, a new baby is born
More than 260,000 people have been killed by volcanic activity since 1700 AD.
The only predator that polar bears have are humans
Many insects can carry 50 times their own body weight
The last land battle of the U.S. Civil War was fought in Texas
Annually 7 million tons of textiles and clothing is thrown out. Out of this, only 12% is used again or recycled
A scorpion can have up to 12 eyes
A snake charmer in Bangladesh once found 3,500 poisonous cobras and their eggs hidden underneath the floors of two suburban homes
The IRS employees tax manual has instructions for collecting taxes after a nuclear war
There are approximately fifty Bibles sold each minute across the world
The pectin that is found in apples aids in lowering cholesterol levels
Post-It Notes, which are adhesive notes, were invented while looking for a way to improve the acrylate adhesive found in tapes
Crayola Crayons currently has over 120 different crayon colors
Odontophobia is the fear of teeth
The width of a tornado can range from less than ten yards to more than a mile.
In Johannesburg, the average car will be involved in an accident once every four years.
The youngest actress to be nominated as best actress is Keisha Castle-Hughes who was nominated at just 13 years old
The Taj Mahal was actually built for use as a tomb
According to studies, an average roll of toilet paper lasts about five days in the bathroom
Almonds are members of the peach family
The oldest known disease in the world is leprosy
A fall of 30 feet can be survived my most cats
The largest member of the dolphin family are orcas
In 1477, the first diamond engagement ring was given to Mary of Burgundy by Archduke Maximillian of Austria
The hormone replacement drug "Premarin" is made from the urine of pregnant horses
TWIX Caramel Cookie Bars were first introduced in 1979
Nintendo was first establish in 1889 and they started out making special playing cards
People over the age of fifty will start to lose their dislike for foods that taste bitter
In Kentucky, 50 percent of the people who get married for the first time are teenagers
Elephants have been known to learn up to 60 commands
On average 1,668 gallons of water are used by each person in the United States daily
Copper is the second most used metal in the world.
Milton Bradley originally wanted to name the game Twister, Pretzel; but he could not since the name was copyrighted
According to studies, men prefer to have white bedrooms and women prefer to have blue bedrooms
If someone was to fly once around the surface of the moon, it would be equal to a round trip from New York to London
St. Patrick never really drove out any snakes from Ireland. This story was an analogy of how he drove paganism out of Ireland
Fat is important for the development of children and normal growth
The most common seasonings found in American homes are chili powder, cinnamon, and seasoned salts
People who have eaten beetles say that it tastes like apples
Montreal was named after a local mountain "Mont Royal."
Millie the White House dog earned more than 4 times as much as President Bush in 1991. And, rightfully so
In an average lifetime, a person will spend 4 years traveling in an automobile and six months waiting at a red light.
A small drip from a faucet can waste up to 50 gallons of water daily, which is enough water to run a dishwasher twice on a full cycle
Kotex was first manufactured as bandages, during W.W.I
The longest Monopoly game ever played was 1,680 hours long, which is seventy straight days
The first known contraceptive was crocodile dung, used by Egyptians in 2000 B.C
Over 1,600 people in North America have been victims of trunk entrapment (being locked inside of a car trunk)
A rhinoceros horn is made of compacted hair

28
sh/tests/file-researcher_test.sh

@ -0,0 +1,28 @@
#!/usr/bin/env bash
# Unofficial Bash Strict Mode
set -euo pipefail
IFS='
'
FILENAME="student/file-researcher.sh"
# True if FILE exists and is a regular file
if [ -f ${FILENAME} ]; then
# FILE exists and it's not empty
if [ -s ${FILENAME} ]; then
if [[ $(cat $FILENAME | grep echo | wc -l) -ne 0 ]]; then
echo "echo is not allowed in this exercise!"
exit 1
fi
submitted=$(bash $FILENAME)
expected=$(bash solutions/file-researcher.sh)
diff <(echo "$submitted") <(echo "$expected")
else
echo "The file exist but is empty"
exit 1
fi
else
echo "File does not exist"
exit 1
fi

1
sh/tests/solutions/file-researcher.sh

@ -0,0 +1 @@
grep "It takes 12 honey" file-researcher/facts.txt && grep -n "year" file-researcher/facts.txt

45
subjects/devops/file-researcher/README.md

@ -0,0 +1,45 @@
## file-researcher
### Instructions
Create a file `file-researcher.sh`, which will look in the `file-researcher/facts.txt` file for the following:
- The complete sentence which begins like so `It takes 12 honey`.
- All the lines where the word `year` appears.
You can not use "echo"!
Expected Output:
```console
$ ./file-researcher.sh | cat -e
It takes 12 honeybees to make one teaspoon of honey$
6:898 tornadoes were recorded to have occurred in the United States in the year 2000.$
12:The only two days of the year in which there are no professional sportsgames (MLB, NBA, NHL, or NFL) are the day before and the day after theMajorLeague All-Star Game.$
15:All dogs are the descendant of the wolf. These wolves lived in eastern Asia about 15,000 years ago$
32:Most fleas do not live past a year old$
39:Every 238 years, the orbits of Neptune and Pluto change making Neptune at times the farthest planet from the sun$
60:A maple tree is usually tapped when the tree is at least 45 years old and has a diameter of 12 inches$
63:An acre of trees can remove about 13 tons of dust and gases every year from the surrounding environment$
67:Every year, 100 million sharks are killed by people$
70:One female mouse can produce up to 100 babies a year$
95:In Johannesburg, the average car will be involved in an accident once every four years.$
96:The youngest actress to be nominated as best actress is Keisha Castle-Hughes who was nominated at just 13 years old$
121:In an average lifetime, a person will spend 4 years traveling in an automobile and six months waiting at a red light.$
$
```
### Hints
`grep` is a command-line utility for searching plain-text data sets for lines that match a regular expression.
```console
$ head example.txt
Indonesia consists only of islands - 13,667 total
During World War II, the very first bomb dropped on Berlin by the Allies killed the only elephant in the Berlin Zoo
$ grep "Indonesia" example.txt
Indonesia consists only of islands - 13,667 total
```
> You have to use Man or Google to know more about commands flags, in order to solve this exercise!
> Google and Man will be your friends!
Loading…
Cancel
Save