LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-12-2009, 08:18 AM   #1
simransab
LQ Newbie
 
Registered: Sep 2009
Posts: 23

Rep: Reputation: 15
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..
 
Old 11-12-2009, 08:46 AM   #2
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Rep: Reputation: 55
Quote:
Originally Posted by simransab View Post
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 !!!

Last edited by vinaytp; 11-12-2009 at 08:51 AM.
 
Old 11-12-2009, 08:55 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
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"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I "cat" or "grep" a file to ignore lines starting with "#" ??? callagga Linux - Newbie 7 08-16-2013 07:58 AM
Hostname defined in file "network" changes after change to file "hosts" qwkfish Linux - Networking 2 10-14-2009 05:07 PM
gs not starting "CRIT: rangecheck in get" some TTF file duryodhan Slackware 2 10-01-2007 12:37 AM
"No such file or directory" when starting tinyX rhauff Linux - General 1 12-23-2003 08:53 AM
Can't locate object method "splitpath" via package "File::Spec" RobJohnston Linux - General 2 06-28-2003 10:59 AM


All times are GMT -5. The time now is 02:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration