Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

keep empty lines at the end of files?



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


]]



Messages sorted by: Reverse Date, Date, Thread, Author