BASH Script to Sort the Posts/Videos by Days

in #bash5 years ago (edited)

Writing a BASH script to list all videos of Teaching-Kids-Programming in the time order - making use of AWK programming:

#!/bin/bash 

echo "# Teaching Kids Programming"
echo "[Sort by Categories](https://github.com/DoctorLai/Teaching-Kids-Programming/blob/main/README.md)"

curl -s "https://raw.githubusercontent.com/DoctorLai/Teaching-Kids-Programming/main/README.md" | grep "\[B站\]" | awk -F '|' '{
    print $6"|"$5"|"$3"|"$4
}' | sort -k 1 | awk -F '|' 'BEGIN{days=1}{
    print "- Day " days ": " $2$3$4$5
    days ++
}' | tac

Here is what it produces:

https://github.com/DoctorLai/Teaching-Kids-Programming/blob/main/sort-by-days.md

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Thank you for reading ^^^^^^^^^^^^^^^

NEW! Following my Trail (Upvote or/and Downvote)

Follow me for topics of Algorithms, Blockchain and Cloud.
I am @justyy - a Steem Witness
https://steemyy.com

My contributions

Delegation Service

Important Update of Delegation Service!

  • Delegate 1000 to justyy: Link
  • Delegate 5000 to justyy: Link
  • Delegate 10000 to justyy: Link

Support me

If you like my work, please:

  1. Delegate SP: https://steemyy.com/sp-delegate-form/?delegatee=justyy
  2. Vote @justyy as Witness: https://steemyy.com/witness-voting/?witness=justyy&action=approve
  3. Set @justyy as Proxy: https://steemyy.com/witness-voting/?witness=justyy&action=proxy
    Alternatively, you can vote witness or set proxy here: https://steemit.com/~witnesses

Coin Marketplace

STEEM 0.04
TRX 0.32
JST 0.083
BTC 60221.23
ETH 1581.59
USDT 1.00
SBD 0.42