LinuxQuestions.org
Latest LQ Deal: Linux Power User 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 02-11-2019, 12:04 AM   #1
catiewong
Member
 
Registered: Aug 2018
Posts: 176

Rep: Reputation: Disabled
find the string with "/"


I would like to use find command to find string in a directory .

the string with "/" , for example , find string in path with with the string "/ori/data"

what can I do ?


thanks
 
Old 02-11-2019, 04:01 AM   #2
l0f4r0
Member
 
Registered: Jul 2018
Location: Paris
Distribution: macOS, Slackware
Posts: 782

Rep: Reputation: 270Reputation: 270Reputation: 270
Do you mean you have some directory names with "/" inside?
If so, I think this is a really bad idea as slash character is already used for hierarchy/tree concept...

Last edited by l0f4r0; 02-11-2019 at 04:02 AM.
 
Old 02-11-2019, 04:49 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,655

Rep: Reputation: 2987Reputation: 2987Reputation: 2987Reputation: 2987Reputation: 2987Reputation: 2987Reputation: 2987Reputation: 2987Reputation: 2987Reputation: 2987Reputation: 2987
Please provide some path examples, those which should be found and those that are skipped, and also show us the command you have used to find what you are after?

Remember, this community is about assisting you to learn and not about doing the work for you.
 
Old 02-11-2019, 04:53 AM   #4
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 3,683
Blog Entries: 3

Rep: Reputation: 1649Reputation: 1649Reputation: 1649Reputation: 1649Reputation: 1649Reputation: 1649Reputation: 1649Reputation: 1649Reputation: 1649Reputation: 1649Reputation: 1649
Yes please provide some examples. However just to take a wild guess based on common tasks maybe you would be interested in the two utilities: dirname and basename.

Code:
$ basename /var/www/html/index.html 
index.html

$ dirname /var/www/html/index.html 
/var/www/html

Last edited by Turbocapitalist; 02-11-2019 at 04:55 AM.
 
Old 02-11-2019, 02:09 PM   #5
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.5
Posts: 2,402

Rep: Reputation: 786Reputation: 786Reputation: 786Reputation: 786Reputation: 786Reputation: 786Reputation: 786
Quote:
Originally Posted by catiewong View Post
I would like to use find command to find string in a directory .

the string with "/" , for example , find string in path with with the string "/ori/data"

what can I do ?


thanks
As has been said, your question isn't very clear...have you studied the find man page?
To find a file named data in a directory name /ori
Code:
find /ori -name data
You don't need to reference the slash between ori and data in the command.
Is that what you mean?
 
Old 02-11-2019, 03:08 PM   #6
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: Slackware
Posts: 8,686

Rep: Reputation: 3702Reputation: 3702Reputation: 3702Reputation: 3702Reputation: 3702Reputation: 3702Reputation: 3702Reputation: 3702Reputation: 3702Reputation: 3702Reputation: 3702
Quote:
Originally Posted by catiewong View Post
the string with "/" , for example
Unless that is specifically what you want to search for, you should pick a different example.

Last edited by dugan; 02-11-2019 at 03:17 PM.
 
  


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
[SOLVED] replace any line in all files that contains "string <something>" with "string something else" Quakeboy02 Linux - Software 6 04-17-2017 04:30 PM
Lubuntu 15.04 "error: invalid string constant "thunar-statusbar", expected valid string constant" error knobby67 Ubuntu 1 12-09-2016 01:19 AM
[SOLVED] Replace a string @CURRANGE("***","***") to @CURRANGE("xxx","xxx") in a file mavadikarmayur Linux - Newbie 3 03-26-2012 09:32 AM
[SOLVED] copy string a to string b and change string b with toupper() and count the chars beep3r Programming 3 10-22-2010 08:22 PM
Help With Java Problem Please"""""""""""" suemcholan Linux - Newbie 1 04-02-2008 07:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:35 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