Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Wildcard... why u no work?
New Posts  All Forums:Forum Nav:

Wildcard... why u no work?

post #1 of 5
Thread Starter 
I'm a complete nub at shell script stuff... but I need help!

I cd to my main directory:
Code:
blah@blah-xx:/??/LOGSVR/COMBINED/2012/02

Then, from there I run:
Code:
for i in 1{4..6}; do zgrep "email_address" /$i/example_file_201202$i-*; done

But where the wildcard should denote any suffix on the filename, it doesn't pick it up and literally searches for asterisk.
Code:
gzip: /14/example_file_20120214-*.gz: No such file or directory
gzip: /15/example_file_20120215-*.gz: No such file or directory
gzip: /16/example_file_20120216-*.gz: No such file or directory

How do I declare * as a wildcard, not the actual search pattern?
post #2 of 5
weird. I frequently use wildcards in grep like this and never had a problem. The only thing I can think of is perhaps try putting your file name in quotes or maybe remove the hyphen.

I'd have though zgrep would support wildcards because there's no mention that it doesn't in man
post #3 of 5
have you tried perhaps doing an escape sequence (character) like the "/" ? Perhaps it's looking for that.
Skyship
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II 1090T BE ASUS Crosshair IV XFX 5770 OCZ AMD Edition  
Hard DriveOSMonitorKeyboard
Seagate Windows 7 Pro Sceptre 22" widescreen Saitek Eclipse 1 
PowerCaseMouseMouse Pad
XION 800w modular Cooler Master Storm Scout Razer DeathAdder Steel Series QCK 
  hide details  
Reply
Skyship
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II 1090T BE ASUS Crosshair IV XFX 5770 OCZ AMD Edition  
Hard DriveOSMonitorKeyboard
Seagate Windows 7 Pro Sceptre 22" widescreen Saitek Eclipse 1 
PowerCaseMouseMouse Pad
XION 800w modular Cooler Master Storm Scout Razer DeathAdder Steel Series QCK 
  hide details  
Reply
post #4 of 5
Thread Starter 
Quote:
Originally Posted by Poseiden View Post

have you tried perhaps doing an escape sequence (character) like the "/" ? Perhaps it's looking for that.

How do you mean sorry?
post #5 of 5
Quote:
Originally Posted by Poseiden View Post

have you tried perhaps doing an escape sequence (character) like the "/" ? Perhaps it's looking for that.

Escaping it would be "\". I really doubt you'd want to do that as well as the point of escaping a character is you're telling the interpreter / compiler to include that char as part of the string (which in this case, you don't want).

That said, it's not behaving as expected anyway, so i guess you lose nothing in trying smile.gif
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Wildcard... why u no work?