• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

Text in feste Laenge formatieren

NoSuchGuy

Newbie
hallo forum,

ich suche ein simples programm welches text in eine feste laenge formatiert indem Leerzeichen eingefuegt werden so wie es z.B. im Jargon-File der fall ist. fmt/fold koennen das soweit ich weis nicht. jemand eine idee?

mfg NoSuchGuy
 

regexer

Advanced Hacker
Als Linux-Bordmittel gibt es folgendes:
Code:
~> typeset -L8 test=1234
~> echo \'"$test"\'
'1234    '
~> typeset -R8 test
~> echo \'"$test"\'
'    1234'
typeset kann man auch machen, wenn die Varialbe schon gefüllt ist. L/R steht für links- oder rechtsbündig. 8 logsicherweise für die Länge.
 

TeXpert

Guru
stimmt, fmt ist hier nicht die richtige Lösunge :)

2 Alternativen:

1. Emacs
Code:
M-1 M-q

2. http://www.nicemice.net/par/


[/code]
 
OP
N

NoSuchGuy

Newbie
danke erstmal fuer deine antwort.

typeset fuegt, wie ich das sehe, leerzeichen am anfang (-R n) bzw. ende (-L n) einer zeile ein.
ich moechte das innerhalb der zeile so lange leerzeichen eingefuegt werden bis diese einer bestimmten laenge (n) entspricht, in etwa so:

Code:
$ cat test.txt
1. A person who enjoys exploring the details of programmable systems
and how to stretch their capabilities, as opposed to most users, who
prefer to learn only the minimum necessary. RFC1392, the Internet
Users' Glossary, usefully amplifies this as: A person who delights in
having an intimate understanding of the internal workings of a
system, computers and computer networks in particular.

$ cat test.txt | FORMATIERUNGS_PROGRAMM
1.  A person who enjoys exploring the details of programmable systems
and  how to stretch their capabilities, as opposed to most users, who
prefer  to  learn  only  the minimum necessary. RFC1392, the Internet
Users' Glossary, usefully amplifies this as: A person who delights in
having  an  intimate  understanding  of  the  internal  workings of a
system, computers and computer networks in particular.

ich hoffe das die fragestellung klar ist.

mfg NoSuchGuy
 

TeXpert

Guru
lies meine Antwort ;)

Code:
andreas@sam2:~/tmp> cat text
1. A person who enjoys exploring the details of programmable systems
and how to stretch their capabilities, as opposed to most users, who
prefer to learn only the minimum necessary. RFC1392, the Internet
Users' Glossary, usefully amplifies this as: A person who delights in
having an intimate understanding of the internal workings of a
system, computers and computer networks in particular.

andreas@sam2:~/tmp> Par152/par jw60 <text
1. A person who enjoys exploring the details of programmable
systems and  how to  stretch their capabilities,  as opposed
to  most  users,  who  prefer  to  learn  only  the  minimum
necessary. RFC1392,  the Internet Users'  Glossary, usefully
amplifies  this  as: A  person  who  delights in  having  an
intimate understanding of the internal workings of a system,
computers and computer networks in particular.

andreas@sam2:~/tmp> Par152/par jw25 <text
1.  A  person who  enjoys
exploring the  details of
programmable  systems and
how   to  stretch   their
capabilities,  as opposed
to most users, who prefer
to learn only the minimum
necessary.  RFC1392,  the
Internet Users' Glossary,
usefully  amplifies  this
as: A person who delights
in  having   an  intimate
understanding    of   the
internal  workings  of  a
system,   computers   and
computer    networks   in
particular.
 
Oben