Mercurial > repo
view bin/med @ 12523:67a2e5342dad draft default tip
<b_jonas> learn The password of the month is outside the scope of this wisdom entry.
author | HackEso <hackeso@esolangs.org> |
---|---|
date | Tue, 01 Apr 2025 08:17:53 +0100 |
parents | c989a1669243 |
children |
line wrap: on
line source
#Rewritten by hand #info on lines 2 4 9 15 20 26.. continued on line 2 #32 38 if [ "$1" == "rl" ]; then #readline NUM="$3" cat "$2" | sed "${NUM}!d" exit 0 fi if [ "$1" == "rr" ]; then #readrange NUM="$3" NUM2="$4" cat "$2" | sed "${NUM},${NUM2}!d" exit 0 fi if [ "$1" == "dl" ]; then #delete line NUM="$3" cat "$2" | sed "${NUM}d" > /tmp/med.tmp && mv /tmp/med.tmp "$2" exit 0 fi if [ "$1" == "dr" ]; then #delete range NUM="$3" NUM2="$4" cat "$2" | sed "${NUM},${NUM2}d" > /tmp/med.tmp && mv /tmp/med.tmp "$2" exit 0 fi if [ "$1" == "il" ]; then #insert line NUM="$3" TEXT="$4" cat "$2" | sed "${NUM}a${TEXT}" > /tmp/med.tmp && mv /tmp/med.tmp "$2" exit 0 fi if [ "$1" == "sl" ]; then #Substitute word WORD="$3" WORD2="$4" cat "$2" | sed "s/${WORD}/${WORD2}/g" > /tmp/med.tmp && mv /tmp/med.tmp "$2" exit 0 fi if [ "$1" == "si" ]; then #sub. the nth instance of word on line WORD="$3" WORD2="$4" NUM="$5" cat "$2" | sed "s/${WORD}/${WORD2}/${NUM}" > /tmp/med.tmp && mv /tmp/med.tmp "$2" exit 0 fi if [ "$1" == "ol" ]; then #Override next line NUM="$3" TEXT="$4" cat "$2" | sed "${NUM}d" | sed "${NUM}i${TEXT}" > /tmp/med.tmp && mv /tmp/med.tmp "$2" exit 0 fi exit 1