Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Reading line by line
- X-seq: zsh-users 11379
- From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- To: Micah Cowan <micah@xxxxxxxxxx>
- Subject: Re: Reading line by line
- Date: Wed, 11 Apr 2007 07:38:00 +0100
- Cc: meino.cramer@xxxxxx, zsh-users@xxxxxxxxxx
- In-reply-to: <461C5C81.20609@xxxxxxxxxx>
- Mail-followup-to: Micah Cowan <micah@xxxxxxxxxx>, meino.cramer@xxxxxx, zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20070411033311.GA6837@solfire> <461C5C81.20609@xxxxxxxxxx>
On Tue, Apr 10, 2007 at 08:56:49PM -0700, Micah Cowan wrote:
> meino.cramer@xxxxxx wrote:
> > Hi,
> >
> > how can I read line by line from a file of text?
Most Unix tools (cut, paste, sed, awk...) read files lines by
line, it's generally a bad idea to have the shell read the file
by itself.
[...]
> while read theline
No, read without any option has a special meaning to the shell
while IFS= read -r theline
> do
> echo ${theline}
Same thing for echo.
echo -E - $theline # zsh specific
print -r -- "$theline" # ksh/zsh specific
or POSIXLY:
printf '%s\n' "$theline"
> echo "---------------"
> done < results.txt
[...]
But don't do it, there's probably a much better way to do what
you want to achieve.
--
Stéphane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author