• narshee
    link
    fedilink
    5
    edit-2
    1 year 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 <

    • @[email protected]
      link
      fedilink
      31 year 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"
       [...]