Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Languages
- Recursively enumerable
- Regular
- Minimal automaton
- Turing machine
- Finite
- Languages Minimal automaton
- Recursively enumerable Turing machine
- Regular Finite
- Languages Minimal automaton
- Recursively enumerable Turing machine
- Regular Finite
- $ cat 1
- Chomsky hierarchy
- Type-0
- —
- $ cat 2
- Grammars
- Unrestricted
- $ paste 1 2 | pr -t -e20
- Chomsky hierarchy Grammars
- Type-0 Unrestricted
- — (no common name)
- paste file1 file2 | column -s $'t' -t
- $ paste <(echo foo; echo; echo barbarbar) <(seq 3) | column -s $'t' -t
- foo 1
- 2
- barbarbar 3
- $ paste <(echo foo; echo; echo barbarbar) <(seq 3) | column -s $'t' -tn
- foo 1
- 2
- barbarbar 3
- paste file1 file2 | pr -t -e24
- ┌──────────────────────┬────────────────┬──────────┬────────────────────────────┐
- │ Languages │ Minimal │ Chomsky │ Unrestricted │
- ├──────────────────────┼────────────────┼──────────┼────────────────────────────┤
- │ Recursive │ Turing machine │ Finite │ space indented │
- ├──────────────────────┼────────────────┼──────────┼────────────────────────────┤
- │ Regular │ Grammars │ │ ➀ unicode may render oddly │
- ├──────────────────────┼────────────────┼──────────┼────────────────────────────┤
- │ 1 2 3 4 spaces │ │ Symbol-& │ but the column count is ok │
- ├──────────────────────┼────────────────┼──────────┼────────────────────────────┤
- │ │ │ │ Context │
- └──────────────────────┴────────────────┴──────────┴────────────────────────────┘
- #!/bin/bash
- { echo -e "<html>n<table border=1 cellpadding=0 cellspacing=0>"
- paste "$@" |sed -re 's#(.*)#x091x09#' -e 's#x09# </pre></td>n<td><pre> #g' -e 's#^ </pre></td>#<tr>#' -e 's#n<td><pre> $#n</tr>#'
- echo -e "</table>n</html>"
- } |w3m -dump -T 'text/html'
- +------------------------+-------------------+-------------------+--------------+
- | Languages | Minimal automaton | Chomsky hierarchy | Grammars |
- | Recursively enumerable | Turing machine | Type-0 | Unrestricted |
- | Regular | Finite | — | |
- | Alphabet | | Symbol | |
- | | | | Context |
- +------------------------+-------------------+-------------------+--------------+
- #!/bin/bash
- # Note: The next line is for testing purposes only!
- set F1 F2 F3 F4 # Simulate commandline filename args $1 $2 etc...
- p=' ' # The pad character
- # Get line and column stats
- cc=${#@}; lmax= # Count of columns (== input files)
- for c in $(seq 1 $cc) ;do # Filenames from the commandline
- F[$c]="${!c}"
- wc=($(wc -l -L <${F[$c]})) # File length and width of longest line
- l[$c]=${wc[0]} # File length (per file)
- L[$c]=${wc[1]} # Longest line (per file)
- ((lmax<${l[$c]})) && lmax=${l[$c]} # Length of longest file
- done
- # Determine line-count deficits of shorter files
- for c in $(seq 1 $cc) ;do
- ((${l[$c]}<lmax)) && D[$c]=$((lmax-${l[$c]})) || D[$c]=0
- done
- # Build 'n' strings to cater for short-file deficits
- for c in $(seq 1 $cc) ;do
- for n in $(seq 1 ${D[$c]}) ;do
- N[$c]=${N[$c]}$'n'
- done
- done
- # Build the command to suit the number of input files
- source=$(mktemp)
- >"$source" echo 'paste '
- for c in $(seq 1 $cc) ;do
- ((${L[$c]}==0)) && e="x" || e=":a -e "s/^.{0,$((${L[$c]}-1))}$/&$p/;ta""
- >>"$source" echo '<(sed -re '"$e"' <(cat "${F['$c']}"; echo -n "${N['$c']}")) '
- done
- # include the ASCII-art Table framework
- >>"$source" echo ' | sed -e "s/.*/| & |/" -e "s/t/ | /g" ' # Add vertical frame lines
- >>"$source" echo ' | sed -re "1 {h;s/[^|]/-/g;s/|/+/g;p;g}" ' # Add top and botom frame lines
- >>"$source" echo ' -e "$ {p;s/[^|]/-/g;s/|/+/g}"'
- >>"$source" echo
- # Run the code
- source "$source"
- rm "$source"
- exit
- paste <(sed -re :a -e 's/^.{1,'"$(($(wc -L <F1)-1))"'}$/&./;ta' F1) F2
- # output (No trailing whitespace)
- Languages............. Minimal automaton
- Recursively enumerable Turing machine
- Regular............... Finite
- paste <( sed -re :a -e 's/^.{1,'"$(($(wc -L <F1)-1))"'}$/&./;ta' F1 )
- <( sed -re :a -e 's/^.{1,'"$(($(wc -L <F2)-1))"'}$/&./;ta' F2 )
- # output (With trailing whitespace)
- Languages............. Minimal automaton
- Recursively enumerable Turing machine...
- Regular............... Finite...........
- paste left.txt right.txt | expand -t $(($(wc -L <left.txt) + 1))
- paste left.txt right.txt | expand -t $(awk 'n<length {n=length} END {print n+1}')
- paste left.txt right.txt | column -s '␉' -t
- while read line
- do
- echo ${#line}
- done < file1.txt | sort -n | tail -1
- awk 'FS="---" {printf "%-22sn", $1}' < file1.txt > file1-pad.txt
- $ paste file1-pad.txt file2.txt
- Languages Minimal automaton
- Recursively enumerable Turing machine
- Regular Finite
- paste file1 file2 | sed 's/t/ t/g' | column -s $'t' -t
- paste file1 file2 | sed 's/t/ t/g' | column -s $'t' -t
- paste file1 file2 | sed $'s/t/ t/g' | column -s $'t' -t
- awk '
- NR==FNR { if (length > max_length) max_length = length
- max_FNR = FNR
- save[FNR] = $0
- next
- }
- { printf "%-*s", max_length+2, save[FNR]
- print
- }
- END { if (FNR < max_FNR) {
- for (i=FNR+1; i <= max_FNR; i++) print save[i]
- }
- }
- ' file1 file2
- awk '
- FNR==1 { file_num++ }
- { if (length > max_length[file_num]) max_length[file_num] = length
- max_FNR[file_num] = FNR
- save[file_num,FNR] = $0
- }
- END { for (j=1; j<=file_num; j++) {
- if (max_FNR[j] > global_max_FNR) global_max_FNR = max_FNR[j]
- }
- for (i=1; i<=global_max_FNR; i++) {
- for (j=1; j<file_num; j++) printf "%-*s", max_length[j]+2, save[j,i]
- print save[file_num,i]
- }
- }
- ' file*
Add Comment
Please, Sign In to add comment