using awk to create a script leaves blank spaces that need to be edited out

I am trying to create a script to gzip my oracle backup files so that I can put them on tape.
However, awk leaves spaces where they shouldn't be so have to edit the script that awk creates to get it to work....

########################
ls -al /datafiles/ *.dbf |awk '{print "gzip -c ", $9," >/prodbackup/cold/",$9,".gz"}' >oragz.sh

########################
any ideas as to how to get around this?
LVL 1
bkreynolds48Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
ozoConnect With a Mentor Commented:
awk '{print "gzip -c " $9 " >/prodbackup/cold/" $9 ".gz"}'
0
 
woolmilkporcConnect With a Mentor Commented:
Hi,
just leave out the commas (,) whre a space is not desired. Thsi will concatenate the fields.
e.g.
ls -al /datafiles/ *.dbf |awk '{print "gzip -c ", $9," >/prodbackup/cold/" $9 ".gz"}' >oragz.sh
wmp
0
 
bkreynolds48Author Commented:
thanks - they both worked
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.