LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to "ls" file starting with ./ (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-ls-file-starting-with-768649/)

simransab 11-12-2009 08:18 AM

how to "ls" file starting with ./
 
When i do below command, i get the output:
linux% find ./work_work -type f
./work_work/123.log
./work_work/12212.log
./work_work/842150451_ETS160903_11062009.log
./work_work/bad_summary/-842150451_ETS160903_11062009.log
./work_work/bad_summary/ 123.log
./work_work/bad_summary/-123.log
./work_work/bad_summary/files_to_be_deleted.txt
./work_work/bad_summary/sc
./work_work/bad_summary/sc1
./work_work/bad_summary/sc2
./work_work/bad_summary/12-3.log
./work_work/bad_summary/12 212.log


When i do below command, i get the output:
linux% ls work_work/| grep -P "^( |-)"
123.log
-123.log
-842150451_ETS160903_11062009.log


How to get exactly like 1st out put (starting with ./) with second command (using ls)?

Urgent, thankful for those who can help me..

vinaytp 11-12-2009 08:46 AM

Quote:

Originally Posted by simransab (Post 3754182)
When i do below command, i get the output:
linux% find ./work_work -type f

Try with
Code:

ls -Rl | grep '^-' | grep "work_work"
Cheers !!!

pixellany 11-12-2009 08:55 AM

Urgent?? Why? Is anyone in danger or needing medical attention?

When you say "exactly like", I am **guessing** that you mean that you want the path from the current directory. I don't find a simple way of doing it, but it seems there should be one. Look at "man ls" and "man -k path"


All times are GMT -5. The time now is 08:05 PM.