LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-21-2012, 04:46 AM   #1
implosions
LQ Newbie
 
Registered: Jun 2011
Posts: 13

Rep: Reputation: 0
Bash RegExp troubles


This is the line:

Code:
pm.php?id=33142&set_lan=de
I have around 9000 files I need to remove, and I'm absolutely sure this will need a regexp.

I've tried something like this:

Code:
rm *.php\?id=[0-9]{5}\&set_lan=[a-z]{2}
Quote:
rm: cannot remove `*.php?id=[0-9]{5}&set_lan=[a-z]{2}': No such file or directory
What am I doing wrong?

Last edited by implosions; 01-21-2012 at 05:15 AM.
 
Old 01-21-2012, 04:51 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,353
Blog Entries: 55

Rep: Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541
Expansion thing. Try 'find /dir -type f -iname \*pm.php?id=\*set_lan=\*;' and use exec or feed it to xargs.
 
1 members found this post helpful.
Old 01-21-2012, 05:15 AM   #3
implosions
LQ Newbie
 
Registered: Jun 2011
Posts: 13

Original Poster
Rep: Reputation: 0
Excellent, that's exactly what I needed!

I'm on 1000 of (usable) files now, thank you!
 
  


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] bash: regexp in 'if' doesn't evaluate correctly rrije Programming 6 03-01-2011 11:45 PM
[SOLVED] bash regexp string compare stopped working jcrowley Programming 10 10-21-2010 12:03 PM
deleting a line matching two or more regexp in bash, sed maybe? patolfo Programming 21 05-21-2010 12:30 PM
BASH Scripting Troubles with IF and FUNCTION semaja2 Linux - Software 10 01-26-2006 02:04 AM
Bash-programming: RegExp? theonebeyond Programming 9 12-08-2004 02:26 AM


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