bryan
June 30, 2006, 11:04am
1
hi folks
how do i output contents of file in standard output.
in my script, i say
x=`cat filename'
echo $x
below is the actual file
***********
asda afdf fdf sdf dsfsdfsd fds dsfdfsdfsdg ssgd sgdg
sdfsdgfsdg dgfd gsfd gs sdg sfdg s
in my script, i am trying to output the contents of file to standard output
i am getting it as
filea fileb filec filed .profile
asda afdf fdf sdf dsfsdfsd fds dsfdfsdfsdg ssgd sgdg sdfsdgfsdg dgfd gsfd gs sdg sfdg s
there is no newline character and * is being replaced by each single file in the directory
set noglob
turns off the substitution of *. This works for a lot of shells, if it does not work for yours go into your manpage for the shell you are using and find out about globbing.
bryan
June 30, 2006, 11:59am
3
thanks
How can I send contents of a file to standard output inside a script and not loose the newline character?
bryan
June 30, 2006, 12:47pm
4
it was as simple as putting
cat filename
inside the script
dumb of me
thanks guys
#!/bin/ksh
# t.sh
while read record
do
echo "$record"
done <filename_to_read
t.sh > newfile