?
Solved

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

Posted on 2010-08-26
3
Medium Priority
?
323 Views
Last Modified: 2012-05-10
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?
0
Comment
Question by:bkreynolds48
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 1000 total points
ID: 33531462
awk '{print "gzip -c " $9 " >/prodbackup/cold/" $9 ".gz"}'
0
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 1000 total points
ID: 33531481
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
 
LVL 1

Author Closing Comment

by:bkreynolds48
ID: 33531563
thanks - they both worked
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question