![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
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! |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
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" Code:
PenetrationReport_(MANN-6)_ByVendor_(01-NOV-2007_01-NOV-2007).csv |
|
#3
|
|||
|
|||
|
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 |
|||
| Google The UNIX and Linux Forums |