## 1st ed one-line WORLD CHAMPIONSHIP held on 2021-06-16 at brcon2021

1.)
- replace all the occurrences of "bitreich" with "Bit reich" in
 all the files in the current directory (bonus point: use ed(1))

 for i in *; do  echo "f\ng/Bit Reich/s//bitreich/g\nw\nq\n" | ed $i ; done

20:35:34         Od1n | %s/bitreich/Bit reich
20:35:55      parazyd | sed 's,bitreich,Bit reich,g' -i *
20:36:06      KatolaZ | Od1n: you can do better
20:36:14      KatolaZ | parazyd: good but dull
20:36:18         Od1n | sed -i 's/bitreich/Bit reich' *
20:36:52      KatolaZ | parazyd gets 3 points

20:37:38      KatolaZ | you would get 100 extra points for using ed(1)
20:37:40    @Evil_Bob | thats what she sed

Scoreboard: parazyd 3


2.)
- find all the (candidate) duplicate files in a sub-tree

 find ./ -type f -exec sum {} \; | sort -n | uniq -d

20:39:22    @Evil_Bob | sha256sum * | awk 'x[$1]++'
20:39:41      KatolaZ | Evil_Bob: subtree
20:40:10         Od1n | find|xargs sha256sum| awk '{x[$1]++}'
20:40:19     Poorchop | find(sub { push @duplicates, $File::Find::name if (-e and
                     | $File::Find::dir =~ m/file_name/i) }, catfile($directory));
20:40:19         Od1n | find . -type f|xargs sha256sum| awk '{x[$1]++}'
20:40:33      parazyd | find /subtree -type f | uniq -D
20:40:47      KatolaZ | Od1n: gets 3 points
20:40:50    @Evil_Bob | sha256sum **/* | awk 'x[$1]++

Scoreboard: Od1n 3; parazyd 3


3.)
- estimate the size (in blocks) of a folder without using du(1)

 echo `ls -lRs | grep "^total" | cut -d " " -f 2 | tr '\n' '+' | sed -E 's/\+$//g'` | bc

20:42:35    @Evil_Bob | stat -t dir | cut -f 2 -d ' '
20:42:48         Od1n | findd -type f|xargs stat -c%s |awk '{s+=$1}END{print s}'
20:43:17    @Evil_Bob | stat -c '%s' -t dir
20:44:30         Od1n | findd -type f|xargs stat -c%s |paste -sd+|bc
20:44:58      KatolaZ | Od1n gets 3 points
20:45:00          adc | for f in *; do printf 'q\n' | ed "$f"; done |
                     | awk '{ sum += $1 } END{print sum}'
20:45:03      KatolaZ | Poorchop: gets 1 point
20:45:06      KatolaZ | Evil_Bob: 0.5 point

Scoreboard: Od1n 6; parazyd 3; Poorchop 1; Evil_Bob 0.5

20:46:57      denkiko | ls -dl --block-size=K 'dir' | some awk magic x3


4.)
- create a Frankenstein poem, by collating exactly one random line
 from each of the files in the current directory

 for i in *; do n=`wc -l $i | cut -d " " -f 1`; rnd=`od -An -N2 -i /dev/random`; \
    tail -n +`echo "$rnd%$n+1" | bc` $i | head -1; done

20:47:02      parazyd | for i in * ; do shuf -n1 $i; done
20:47:50         Od1n | cat *|tr -s ' ' '\n'|shuf|xargs -n5
20:48:25      KatolaZ | anyone without shuf(1)?
20:48:06      KatolaZ | parazyd: well done
20:48:48     Poorchop | would've taken me too long to type up my idea
20:49:04      KatolaZ | parazyd gets 3, Od1n gets 1
20:49:10         Od1n | cat *|tr -s ' ' '\n'|sort -k2|xargs -n5

Scoreboard: Od1n 7; parazyd 6; Poorchop 1; Evil_Bob 0.5


5.)
- speed contest: make a patch to a file, which can be applied using "ed(1)"
 (no patch(1), no fuss, no github nonsense....)

 diff -e file1 file2

20:50:01      KatolaZ | the fastest one gets 5 points
20:50:16         Od1n | diff A B
20:51:13       josuah | diff -e A B
20:51:20      KatolaZ | josuah: yes!
20:51:40    @Evil_Bob | echo '!rm -rf /' | ed
20:51:41     Poorchop | so close Od1n
20:51:53      KatolaZ | Evil_Bob: you get 0.5 points for the original one :D

Scoreboard: Od1n 7; parazyd 6; josuah 5; Poorchop 1; Evil_Bob 1

20:52:43     @__20h__ | Od1n, #congratulations
20:52:44        annna | #congratulations: gopher://bitreich.org/9/memecache/congratulations.mkv

20:56:01         Od1n | yes "I WON"|sed 6q



## Post-Competition Interviews for ed-sports magazine

21:12:44     @__20h__ | I am doing a player post-competition interview for the
                     | ed-sports magazine.

### Od1n

21:12:04     @__20h__ | Od1n, what is your secret to the success?
21:12:11     @__20h__ | Od1n, stackoverflow, googlefu?
21:12:12         Od1n | __20h__: i just was lucky: i'll loose the next battle for
                     | sure
21:12:48         Od1n | hmm .. also: 26 years of daily shell. that's help
21:14:45         Od1n | also i have to admit i cheated: one of my anwser was
                     | basically fixing the Evil_Bob's line
21:15:03         Od1n | i made 3 points on this: this is unfair
21:15:58         Od1n | i also had to admit i used an IA trained with pytorch to
                     | help me
21:16:03         Od1n | and i took steroids
21:16:33         Od1n | and i asked my son to help me: he's the one who knows
                     | shell
21:16:57         Od1n | (i'm more confortable with powershell in my dayjob)


### parazyd

21:13:10     @__20h__ | parazyd, how did you feel in the last contest? How was it
                     | when josuah took over?
21:13:21      parazyd | #parazyd
21:13:29        annna | #parazyd: gopher://bitreich.org/9/memecache/parazyd.webm
21:13:50     @__20h__ | parazyd, any words to the people at home?
21:14:01      parazyd | I serve the Soviet Union.
21:14:08     @__20h__ | !!


### josuah

21:13:21            * | josuah takes ascii-cam photos of Od1n
21:15:03       josuah | and I got 5 points to add 3 bytes to Od1n
21:15:23       josuah | so it is a team work in disguise of a competition!


### Poorchop

21:11:09     @__20h__ | Poorchop, maybe next time you are prepared a bit more in perl?
21:11:28     @__20h__ | Poorchop, can I do an interview with you why the perl bros
                     | didn't get into the lead?
21:28:36     Poorchop | I don't know if I'm qualified to speak on behalf of the
                     | Perlbros __20h__
21:28:52     @__20h__ | Poorchop, but you are a perl bro?
21:28:54     @__20h__ | Right?
21:28:59     Poorchop | my excuse is being an old fart with dementia


### Evil_Bob

21:14:36     @__20h__ | Evil_Bob, you got the best solutions and extra points.
                     | Fans see you as the winner of hearts. How does that make
                     | you feel?
21:15:36    @Evil_Bob | Od1n: lol no worries, i dont care :D
21:16:32    @Evil_Bob | Od1n: i also cheated by having beautiful women rubbing my
                     | shoulders