In English, this sed program means: for each line,
- [
123!] if the current line number is not 123, then [d] delete the current line and start the next cycle (i.e. move to the next line); - then (but we only reach this point if the
dcommand was not executed), [q] exit without processing any more lines (but do print out the current line in our dying throes).
Or if you prefer, in shell syntax:
line_number=0
while IFS= read -r pattern_space; do
line_number=$(($line_number+1))
if [ $line_number -ne 123 ]; then # 123!
continue # d
fi
echo "$pattern_space"; break # q
echo "$pattern_space" # implicit final print (never reached)
done