LinuxQuestions.org
Help answer threads with 0 replies.
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 12-12-2012, 06:18 AM   #1
blaise77
LQ Newbie
 
Registered: Dec 2012
Posts: 5

Rep: Reputation: Disabled
Find modified files with special characters


Hello Everybody
i am new to linux so excuse my question.
I am trying to find files modified 1 week ago that contain special characters 'pg' and i am stuck
(putty)
i use

find -mtime +7

How do i specify the special characters ['pg']in command

Thanks
 
Old 12-12-2012, 06:23 AM   #2
bala.linuxtech
Member
 
Registered: Nov 2012
Location: Bangalore
Distribution: RHEL and Centos
Posts: 80

Rep: Reputation: Disabled
Quote:
Originally Posted by blaise77 View Post
Hello Everybody
i am new to linux so excuse my question.
I am trying to find files modified 1 week ago that contain special characters 'pg' and i am stuck
(putty)
i use

find -mtime +7

How do i specify the special characters ['pg']in command

Thanks
Hi

Try this command

#find -mtime +7 "pg"

or

#find -mtime +7 p*

Hope it will helps you !
 
Old 12-12-2012, 06:32 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Well pg aren't what we'd normally call 'special', but I'm guessing you mean as part of the filename?
Code:
find . -mtime +7 -name '*pg*'
http://linux.die.net/man/1/find

Special chars are normally non-printable (aka ctrl chars) or meta chars for regular expressions; generally punctuation marks.

HTH
 
Old 12-12-2012, 06:35 AM   #4
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 840

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
If you mean contain text "pg", I think you'll have to use grep in addition to find. Something like

Code:
    while read fname; do grep -I pg "$fname"; done < <(find . -mtime +7)
 
  


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 to use sed to find lines with special characters bryanwdly Linux - General 2 02-07-2012 01:54 PM
Replacing lines in files that contain special characters arizonagroovejet Linux - General 3 06-22-2009 10:19 PM
bash script to find out more than 1 continuous special characters in a file. kkpal Linux - Newbie 1 06-02-2008 05:56 AM
Copying files with special characters cornish Linux - Newbie 13 12-21-2007 12:22 PM
Searching for files with special characters Yig Linux - Newbie 4 11-08-2007 06:53 PM


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