Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 Mar 2002 12:27:13 -0800 (PST)
From:      Eric Boucher <eric_boucher60@yahoo.com>
To:        FreeBSD <freebsd-questions@FreeBSD.ORG>
Subject:   exact length of a line in a file with the read command
Message-ID:  <20020331202713.66909.qmail@web9401.mail.yahoo.com>

next in thread | raw e-mail | index | archive | help
Hi everyone,
I have this problem:
I want to know the exact length of each line in a
file. But it seems that when the file begin or end
with a space caracter of a tab caracter, the "read"
command in bourne shell delete them and return me only
what begin with a letter and end with a letter. So
when I try to know the exact length of a file (I tried
with both lenght command from "expr" and "nawk"). So
if for example, a line is like this (note: <space>
mean the real space caracter and <tab> the tab
caracter)
<space>toto<tab>
the read return me only:
toto
which is of length = 4
but it is suppose to be of length = 6
 
The same thing append if the space or the tab caracter
are at the end of a line.
I also tried to make IFS="", so the there is no field
seperator, but it doesn't seems to work too.
Can somebody help me?
Thanks

__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - send holiday greetings for Easter, Passover
http://greetings.yahoo.com/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020331202713.66909.qmail>