Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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.

920 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

15 Experts available now in Live!

Get 1:1 Help Now