zsh-users
 help / color / mirror / code / Atom feed
* keep empty lines at the end of files?
@ 2007-02-02  9:03 Marc Chantreux
  2007-02-03 20:52 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Chantreux @ 2007-02-02  9:03 UTC (permalink / raw)
  To: zsh-users

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 )¨


]]


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-02-04 16:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-02  9:03 keep empty lines at the end of files? Marc Chantreux
2007-02-03 20:52 ` Bart Schaefer
2007-02-04 16:46   ` Stephane Chazelas

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).