grep -v '^$\|^\s*#' temp
Этот намного лучше, я получил его из https://stackoverflow.com/questions/17392869/how-to-print-a-file-excluding-comments-and-blank-lines-using-grep-sed
Предполагается, что GNU
grep
или совместимый.
Да, это возможно с управляющими последовательностями в тексте, которые необходимо активировать с помощью опции командной строки -e
или --escapes
.
Посмотрите раздел "SPECIAL ESCAPES" на странице руководства(man enscript
).
SPECIAL ESCAPES
Enscript supports special escape sequences which can be used to add some page formatting commands to ASCII
documents. As a default, special escapes interpretation is off, so all ASCII files print out as everyone
expects. Special escapes interpretation is activated by giving option -e, --escapes to enscript.
All special escapes start with the escape character. The default escape character is ^@ (octal 000); escape
character can be changed with option -e, --escapes. Escape character is followed by escape's name and
optional options and arguments.
Currently enscript supports following escapes:
bgcolor change the text background color. The syntax of the escape is:
^@bgcolor{red green blue}
where the color components red, green, and blue are given as decimal numbers between values 0 and 1.
bggray change the text background color. The syntax of the escape is:
^@bggray{gray}
where gray is the new text background gray value. The default value is 1.0 (white).
color change the text color. The syntax of the escape is:
^@color{red green blue}
where color components red, green and blue are given as decimal numbers between values 0 and 1.
и далее там написано:
font select current font. The syntax of the escape is:
^@font{fontname[:encoding]}
where fontname is a standard font specification. Special font specification default can be used to
select the default body font (enscript's default or the one specified by the command line option -f,
--font).
The optional argument encoding specifies the encoding that should be used for the new font. Currently
the encoding can only be the enscript's global input encoding or ps.
Редактировать:
Пример:
me@debian:~$ echo "normal text @color{1 0 0}red text @font{Courier-Bold10}Courier-Bold 10pt @font{Helvetica-BoldOblique12}Helvetica-BoldOblique 12pt @font{default}default font again" > text.txt
me@debian:~$ enscript -v -e@ text.txt -o text.ps
AFM: scanning path...
AFM: reading font map "/usr/share/enscript/afm/font.map"
processing file "text.txt"...
[ 1 page * 1 copy ] left in text.ps
Посмотрите на имена шрифтов, определенные в вашем файле font.map. Возьмите имя шрифта и добавьте к нему размер (в pt ).