dt@mathcs.emory.edu (Dave Taylor {guest}) (10/09/90)
First off:
I am trying to count the number of characters in a string, but I seem to
be running into problems. I tried:
echo $STRING | wc | awk '{ print $3 }'
the only problem with this is that it drops spaces. I want to count ALL
the characters. I suppose I could just adapt some of the awk scripts that
have been flying on the newsgroups lately, but I was looking for something
clean and simple.
Secondly:
WHY -- WHY -- WHY -- WHY -- WHY -- WHY -- WHY -- WHY -- WHY -- WHY -- WHY ??
Why does the following string get pushed together??
Script:
TITLE="This is some text"
echo "$TITLE"
Output:
This is some text
How to I keep it from being pushed together??
THIRDLY:
The point of all this is to be able to center a header with pwd in it. So that
is says something like:
program 1.1 Check to see foo.bar /u/user
I need to count the spaces between bar and EOL as well as the length of the pwd
string. A while loop using expr to count takes an eternity. What could make
it faster???
Thanks in advance,
--david
--
------- -------
David E. Taylor, OMSS UNIX Development // Operation Mobilization USA
AT&T: (404) 631-0432 +====+ UUCP: {decvax, sun!sunatl, gatech}!emory!om!dt
FAX: (404) 631-0439 +====+ Internet: dt%om.uucp@mathcs.emory.edupaul@unhtel.uucp (Paul S. Sawyer) (10/14/90)
In article <1990Oct10.212943.9227@iwarp.intel.com> merlyn@iwarp.intel.com (Randal Schwartz) writes: > >Overkill. Let nroff do it. But AT&T has determined that nroff is too powerful a tool to include with System V (V.2, anyway...) (Documenter's Workbench optional at extra cost...) >Or, in Perl: OK. The price is right, anyway. (Then there's always AWF! B-) -- Paul S. Sawyer uunet!unh!unhtel!paul paul@unhtel.UUCP UNH Telecommunications attmail!psawyer p_sawyer@UNHH.BITNET Durham, NH 03824-3523 VOX: +1 603 862 3262 FAX: +1 603 862 2030