Skip to content

Instantly share code, notes, and snippets.

@Roiseuxquentin
Last active August 2, 2020 05:24
Show Gist options
  • Save Roiseuxquentin/aa6935afb582f9b4028f364620163550 to your computer and use it in GitHub Desktop.
Save Roiseuxquentin/aa6935afb582f9b4028f364620163550 to your computer and use it in GitHub Desktop.
42 Trip
#!/bin/bash
# eegloo
touch 42sourceCode.ghost
curl -s "https://www.42.fr" > 42sourceCode.ghost
i=1
while [ $i -le 11 ]
do
touch "letter"$i".ghost"
i=$(( $i + 1 ))
done
i=1
cat ./42sourceCode.ghost | head -n 2 | sed 1d | sed 's/^.\|tml.*$//g' > "./letter"$i".ghost"
i=2
cat ./42sourceCode.ghost | head -n 2 | sed 1d | sed 's/^.*pr\|fix.*$//g' > "./letter"$i".ghost"
i=3
cat ./42sourceCode.ghost | head -n 1 | sed 's/^.*htm\|.$//g' > "./letter"$i".ghost"
i=4
cat ./letter3.ghost > "./letter"$i".ghost"
i=5
cat ./42sourceCode.ghost | head -n 2 | sed 1d | sed 's/^.*\/\///g' | cut -c 1-1 > "./letter"$i".ghost"
i=6
echo " " > "./letter"$i".ghost"
i=7
cat ./42sourceCode.ghost | head -n 5 | sed 's/^.*="//g' | sed '1,4d' | cut -c 1-1 > "./letter"$i".ghost"
i=8
cat ./letter5.ghost > "./letter"$i".ghost"
i=9
cat ./42sourceCode.ghost | head -n 2 | sed 1d | sed 's/^.* p//g' | cut -c 1-1 > "./letter"$i".ghost"
i=10
cat ./letter3.ghost > "./letter"$i".ghost"
i=11
cat ./42sourceCode.ghost | head -n 3 | sed "1,2d" | sed 's/^....//g' | cut -c 1-1 > "./letter"$i".ghost"
touch string.ghost
i=1
while [ $i -le 11 ]
do
cat "./letter"$i".ghost" | tr -d "\n" >> string.ghost
i=$(( $i + 1 ))
done
cat string.ghost
rm ./*.ghost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment