• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4062
  • Last Modified:

How can I recursive grep excluding the symlinks?

Hi,

How can I do a recursive grep excluding the symlinks?

Thanks
Jamie
0
jamie_lynn
Asked:
jamie_lynn
  • 3
  • 3
1 Solution
 
Joseph GanSystem AdminCommented:
ls -lR | grep -v "^l"
0
 
jamie_lynnAuthor Commented:
Hi ganjos,

Would this not go into the symlink directory or just hide the results?
I need grep not even to go into the symlink directory, as there are symlinks that point to itself.

Thanks
Jamie
0
 
Joseph GanSystem AdminCommented:
No, symlink is not a directory, it is a file.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Joseph GanSystem AdminCommented:
Basically, symlink links two files, but if the target is a directory, another file named "source file" is created in target and linked to the original "source file". So eventually links two files as well.

You can do a quick test in /usr/bin directory with the command. Hopefully this answered your question.
0
 
jamie_lynnAuthor Commented:
Ah i see.
Thanks!
0
 
jamie_lynnAuthor Commented:
That works
0
 
TintinCommented:
I thought you wanted to do a recursive grep and not a recursive ls.

For a recursive grep excluding symlinks, just do:

find . -type f | xargs grep string

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now