Solved

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

Posted on 2010-08-26
3
307 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 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sed -- search an replace multiple pattern 11 101
Shell script errors 10 143
Unix process listing into CSV format 3 52
insert flat files in to tables based upon first character 1 34
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…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
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…

733 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