zsh-users
 help / color / mirror / code / Atom feed
From: Marc Chantreux <marc.chantreux@ulpmm.u-strasbg.fr>
To: zsh-users <zsh-users@sunsite.dk>
Subject: keep empty lines at the end of files?
Date: Fri, 02 Feb 2007 10:03:46 +0100	[thread overview]
Message-ID: <45C2FE72.7040303@ulpmm.u-strasbg.fr> (raw)

hi all,

I have some files with very important empty lines at the end of them.

I try to grab the file content but i don't find easy syntax to honor 
those lines.

Is the a clean and short way to *not* trim the file ?

Regards
mc

Exemple:
Script :

cat -n ldap_user_passwd
print '# read all file does not work'
read -rd$'\0' content < ldap_user_passwd
print "[[$content]]"
print
print '# <  does not work'
print "[[$( < ldap_user_passwd )]]"
print '# read each line works ... but i hope there is shorter way'
content=; < ldap_user_passwd while { read line } { content+=$line$'\n' }
print "[[$content]]"


OUPUT :

      1
      2  dn: ¨-$entry[dn]¨
      3  changetype: modify
      4  replace: userPassword
      5  userPassword: ¨-$( pwd/Next )¨
      6
      7
# read all file does not work
[[dn: ¨-$entry[dn]¨
changetype: modify
replace: userPassword
userPassword: ¨-$( pwd/Next )¨]]

# <  does not work
[[
dn: ¨-$entry[dn]¨
changetype: modify
replace: userPassword
userPassword: ¨-$( pwd/Next )¨]]
# read each line works ... but i hope there is shorter way
[[
dn: ¨-$entry[dn]¨
changetype: modify
replace: userPassword
userPassword: ¨-$( pwd/Next )¨


]]


             reply	other threads:[~2007-02-02  9:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-02  9:03 Marc Chantreux [this message]
2007-02-03 20:52 ` Bart Schaefer
2007-02-04 16:46   ` Stephane Chazelas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45C2FE72.7040303@ulpmm.u-strasbg.fr \
    --to=marc.chantreux@ulpmm.u-strasbg.fr \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).