LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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-10-2019, 11:04 PM   #1
catiewong
Member
 
Registered: Aug 2018
Posts: 190

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, 03:01 AM   #2
l0f4r0
Member
 
Registered: Jul 2018
Location: Paris
Distribution: Debian
Posts: 900

Rep: Reputation: 290Reputation: 290Reputation: 290
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 03:02 AM.
 
Old 02-11-2019, 03:49 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192
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, 03:53 AM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,310
Blog Entries: 3

Rep: Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722
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 03:55 AM.
 
Old 02-11-2019, 01:09 PM   #5
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
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, 02:08 PM   #6
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,226

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
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 02:17 PM.
 
  


Reply



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 03:30 PM
Lubuntu 15.04 "error: invalid string constant "thunar-statusbar", expected valid string constant" error knobby67 Ubuntu 1 12-09-2016 12:19 AM
[SOLVED] Replace a string @CURRANGE("***","***") to @CURRANGE("xxx","xxx") in a file mavadikarmayur Linux - Newbie 3 03-26-2012 08: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 07:22 PM
Help With Java Problem Please"""""""""""" suemcholan Linux - Newbie 1 04-02-2008 06:02 PM

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

All times are GMT -5. The time now is 12:18 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
Open Source Consulting | Domain Registration