Puoi farlo con cat e reindirizzare l'output a less:
cat -e yourFile | less
Questo estratto da man cat spiega cosa -e significa:
-e equivalent to -vE
-E, --show-ends
display $ at end of each line
-v, --show-nonprinting
use ^ and M- notation, except for LFD and TAB
less guarderà nel suo ambiente per vedere se c'è una variabile chiamata LESS
Puoi impostare LESS in uno dei tuoi ~/.profile (.bash_rc, etc, etc) e poi ogni volta che esegui less dalla riga di comando, troverà LESS.
Prova ad aggiungere questo
export LESS="-CQaix4"
Questa è la configurazione che utilizzo, ci sono alcuni comportamenti incorporati che potrebbero confonderti, quindi puoi scoprire cosa significano tutti questi dalla funzione di aiuto in less , tocca semplicemente il tasto "h" e muovi il naso oppure esegui less --help .
Modifica:
Ho guardato la guida e ho notato che c'è anche un -r opzione
-r -R .... --raw-control-chars --RAW-CONTROL-CHARS
Output "raw" control characters.
Accetto che cat potrebbe essere la corrispondenza più esatta con le tue esigenze dichiarate.
cat -vet file | less
Aggiungerà '$' alla fine di ogni riga e convertirà il carattere di tabulazione in '^I' visivo.
cat --help
(edited)
-e equivalent to -vE
-E, --show-ends display $ at end of each line
-t equivalent to -vT
-T, --show-tabs display TAB characters as ^I
-v, --show-nonprinting use ^ and M- notation, except for LFD and TAB
Spero che questo aiuti.
Nello stesso spirito di https://stackoverflow.com/a/6943976/7154924:
cat -A
-A, --show-all
equivalent to -vET
-v, --show-nonprinting
use ^ and M- notation, except for LFD and TAB
-E, --show-ends
display $ at end of each line
-T, --show-tabs
display TAB characters as ^I
In alternativa, o allo stesso tempo, puoi reindirizzare a tr per sostituire caratteri arbitrari con quelli desiderati per la visualizzazione, prima di reindirizzare a un cercapersone come less se lo si desidera.
Per less usa -u per visualizzare i ritorni a capo (^M ) e backspace (^H ) o -U per mostrare le schede precedenti e (^I ) ad esempio:
$ awk 'BEGIN{print "foo\bbar\tbaz\r\n"}' | less -U
foo^Hbar^Ibaz^M
(END)
Senza il -U switch l'output sarebbe:
fobar baz
(END)
Vedi man less per una descrizione più esatta delle caratteristiche.