• narshee@iusearchlinux.fyi
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    2 years ago

    cat
    while read -r l; do echo "$l"; done <

    cat -e
    while read -r l; do echo "$l"$; done <

    cat -n
    n=0; while read -r l; do n="$((n+1))"; printf '%5d %s\n' "$n" "$l"; done <

    cat -b
    n=0; while read -r l; do [ -n "$l" ] && n="$((n+1))" && printf '%5d %s' "$n" "$l"; echo; done <

    • gmg@beehaw.org
      link
      fedilink
      arrow-up
      2
      ·
      2 years ago
      $ n=0; while read -r l; do n="$((n+1))" printf '    %d %s\n' "$n" "$l"; done < /etc/os-release 
          0 NAME="openSUSE Tumbleweed"
          0 # VERSION="20230619"
          0 ID="opensuse-tumbleweed"
       [...]