![]() |
|
|
|
|
|||||||
| 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 |
| List files with full path | mr_bold | Shell Programming and Scripting | 3 | 10-07-2008 09:19 AM |
| list all files with full path of the file | Sowser | UNIX for Advanced & Expert Users | 4 | 02-13-2007 02:46 PM |
| cp list of files into another directory | pavan_test | UNIX for Dummies Questions & Answers | 4 | 05-08-2006 06:08 PM |
| list of files in one Directory | venkyA | UNIX for Dummies Questions & Answers | 3 | 06-24-2005 01:49 PM |
| Removing duplicate files from list with different path | vino | Shell Programming and Scripting | 10 | 05-12-2005 05:44 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi
I am writing a script to find the list of files in dir1 and my script is place in dir2 while doing ls of files dir1 it is displaying with path. I would like to omit the path and display the only file name so that I can pass it to my script as arguments. for filename in $datafiles/*.dat #cat $filename | do echo "in for loop $filename " grep -i "dummy file" $filename > /dev/null || echo $filename >> temp if [ -s temp ] then touch checkfile fi done This script is taking the path also . Any help Appreciated Thank you Madan |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Something like this?
Code:
echo "./somedir1/somedir2/somefile"| sed 's!.*\/\([^\/]*\).*!\1!g'
somefile
#or
echo "./somedir1/somedir2/somefile"| awk -F"/" '{print $NF}'
somefile
|
|
#3
|
||||
|
||||
|
Use the basename command. Checkout man basename.
|
||||
| Google The UNIX and Linux Forums |