Solved

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

Posted on 2010-08-26
3
278 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
3 Comments
 
LVL 84

Accepted Solution

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

Assisted Solution

by:woolmilkporc
woolmilkporc earned 250 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

746 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now