The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Removing a file from a directory npatel Filesystems, Disks and Memory 5 05-22-2008 07:47 AM
Removing the oldest file in a directory pavan_movva Shell Programming and Scripting 2 10-10-2006 08:38 AM
input a line at the beginning of every file in a directory? Terrible Shell Programming and Scripting 6 08-16-2006 03:42 AM
perl question - removing line from input file reggiej Shell Programming and Scripting 3 06-07-2005 10:45 AM
removing a directory da_curtain UNIX for Dummies Questions & Answers 7 12-23-2003 10:55 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 06-02-2008
Registered User
 

Join Date: May 2008
Posts: 4
Unhappy removing directory in an input file

Hi,

How can I removed the directory in the input file?

The script responsible for storing the report in an input file is this:

[i]while [ $i -lt "${#penfilename[*]}" ]
do

echo "penetration|${penfilename[i]}|${penfilenamedaterange}" >> ${OUT_DIR}/penrpt_emailfile.txt

(( i=i+1 ))

done


For the penfilename:

penfilename[i]=`echo ${OUTFILE}*"(${daterange})".csv`

Example of an input file is this:
penetration|/app/rms/rms/data/preticketing/penrpt/PenetrationReport_(MANN-6)_ByBuyer_(01-NOV-2007_01-NOV-2007).csv /app/rms/rms/data/preticketing/penrpt/PenetrationReport_(MANN-6)_ByVendor_(01-NOV-2007_01-NOV-2007).csv

Please help me!

I tried this script

penfilename[i]=`echo PenetrationReport*"(${daterange})".csv`

But its not working because it gives me an output of:

penetration|PenetrationReport*(01-NOV-2007_01-NOV-2007).csv.

My objective is to remove the output directory. This the result I'm expecting to have:

penetration|PenetrationReport_(MANN-6)_ByBuyer_(01-NOV-2007_01-NOV-2007).csv PenetrationReport_(MANN-6)_ByVendor_(01-NOV-2007_01-NOV-2007).csv

Thanks a lot!
Reply With Quote
Forum Sponsor
  #2  
Old 06-02-2008
robotronic's Avatar
Can I play with madness?
 

Join Date: Apr 2002
Location: Italy
Posts: 370
I didn't understand very well your script, but if you want to get rid of a directory name given a full pathname, try the command "basename", eg.:

Code:
basename "/app/rms/rms/data/preticketing/penrpt/PenetrationReport_(MANN-6)_ByVendor_(01-NOV-2007_01-NOV-2007).csv"
Will return:
Code:
PenetrationReport_(MANN-6)_ByVendor_(01-NOV-2007_01-NOV-2007).csv
Reply With Quote
  #3  
Old 06-04-2008
Registered User
 

Join Date: May 2008
Posts: 4
removing directory in an input file

Hi,

Thanks for your time..

But the problem is, this script basename "/app/rms/rms/data/preticketing/penrpt/PenetrationReport_(MANN-6)_ByVendor_(01-NOV-2007_01-NOV-2007).csv"
is not applicable because those where just the results of the generated report. I cannot directly changed that.

Okay..to better understand:

penfilename[i]=`echo ${OUTFILE}*"(${daterange})".csv` --> this script stores the generated reports. And the generated report is the records in the output file.

Since OUTFILE is consists of the output directory and PenetrationReport.(/app/rms/rms/data/preticketing/penrpt/ --> output directory and PenetrationReport)

I need to removed the output directory but retains the looping.

the responsible script for the looping is this:

[i][i]while [ $i -lt "${#penfilename[*]}" ]
do

echo "penetration|${penfilename}|${penfilenamedaterange}" >> ${OUT_DIR}/penrpt_emailfile.txt

(( i=i+1 ))

done


I hope you can really help me.. This is an urgent task I needed to submit. And I don't know much on unix..

Thanks a lot
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:38 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0