LinuxQuestions.org
Register a domain and help support LQ
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 04-19-2016, 03:49 AM   #1
arun natarajan
Member
 
Registered: Jun 2014
Posts: 96

Rep: Reputation: Disabled
filter only files with starting character.


Hi,

From the directory cg, i want to list only files starting with v.
Though i ve tried different cmds, its not helping
I dont want to use FIND cmd here.
[root@server cg]# ls -ltr
total 68
-rw-r--r--. 1 root root 45650 Apr 19 09:30 passwd-bkp
-rw-r--r--. 1 root root 43 Apr 19 10:02 user
-rw-r--r--. 1 root root 120 Apr 19 11:17 employees
-rw-r--r--. 1 root root 88 Apr 19 11:22 op.txt
-rwxr-xr-x. 1 root root 109 Apr 19 11:38 sap
-rw-r--r--. 1 root root 0 Apr 19 12:53 van
drwxr-xr-x. 03 root root 4096 Apr 19 12:57 volvo

[root@server cg]# ls -l v*
-rw-r--r--. 1 root root 0 Apr 19 12:53 van

volvo:
total 4
-rw-r--r--. 1 root root 0 Apr 19 12:57 c1
drwxr-xr-x. 2 root root 4096 Apr 19 12:57 d1


[root@server cg]# ls -l v* | grep ^-
-rw-r--r--. 1 root root 0 Apr 19 12:53 van
-rw-r--r--. 1 root root 0 Apr 19 12:57 c1
 
Old 04-19-2016, 04:13 AM   #2
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,686
Blog Entries: 23

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
edited out - sorry - answer was for some other thread...
Oops
Melissa

Last edited by ButterflyMelissa; 04-19-2016 at 04:14 AM. Reason: posted in the wrong thread, sorry
 
Old 04-19-2016, 04:26 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,251

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
I never really understand when people say "I don't want to use command X". if a particular command is designed to do exactly what you want, why would you want to combine several
to achieve the same task?

Processing ls in of itself can be error prone and find will do the task.

By all means, keep creating your new better wheel.
 
  


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
ls only files starting with upper case character sancho1980 Linux - Newbie 17 09-29-2016 09:41 AM
[bash] find - filter files matching a list of files hashbang#! Programming 6 11-25-2010 06:01 PM
Some character adding up starting of log file? your_shadow03 Linux - Newbie 42 03-03-2010 08:26 AM
open office doesn't work and gives me the Filter Selection box on starting chadwick Linux - Software 3 06-18-2009 07:09 PM
Is it possible to have sed only process starting from, say, the 9th character on? lumix Linux - Newbie 3 05-13-2008 10:26 PM


All times are GMT -5. The time now is 06:37 AM.

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