Sponsored Content
Full Discussion: grep and wildcards
Top Forums UNIX for Dummies Questions & Answers grep and wildcards Post 65825 by Lomic on Wednesday 9th of March 2005 10:31:11 AM
Old 03-09-2005
grep and wildcards

Hi guys,

a small problem today, I'm grepping a log file containing lines like this below:
Code:
Mar 09 16:04:00 blabla
Mar 09 16:04:02 blabla
Mar 09 16:04:05 blabla
Mar 09 16:04:15 blabla
Mar 09 16:05:06 blabla
Mar 09 16:05:23 blabla
Mar 09 16:05:25 blabla
...

in this file I'm grepping expressions in "blabla" and I count how many off them are found per minute

like this for example:
Code:
grep my_expression my_log_file | grep "Mar 09 16:04" |wc -l

I want to wildcard "Mar 09 " so my grep is not dependant on the day anymore
(which can be "Thu 21 " or anything else)

Thanks for your help Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Wildcards in VI

I'm trying to delete lines from a large text file using VI. Every line that I am wanting to delete start with 'S' - all others do not. (A list of users) I've tried using * but doesn't seem to like it...any ideas... Doesn't have to be VI - but I'm better with VI than sed/awk. (8 Replies)
Discussion started by: peter.herlihy
8 Replies

2. UNIX for Dummies Questions & Answers

Wildcards In UNIX

on my SCO UNIX wild cards are not displaying wanted result. Why like that . I think that i was not using proper command . what are there . how can i use the wildcards in UNIX. (7 Replies)
Discussion started by: smdakram
7 Replies

3. UNIX for Dummies Questions & Answers

wildcards

when writing a shell script (bourne) and using a unix command like 'ls' is there anything special you need to do to use a wildcard (like *)? (3 Replies)
Discussion started by: benu302000
3 Replies

4. UNIX for Dummies Questions & Answers

ls with wildcards

ok, I'm trying to write a script file that lists files with specific elements in the name into a txt file, it looks like this ls s*.dat > file_names.txt can't figure out whats wrong with that line, any ideas? thanks in advance (10 Replies)
Discussion started by: benu302000
10 Replies

5. UNIX for Dummies Questions & Answers

wildcards NOT

Hi All Please excuse another straightforward question. When creating a tar archive from a directory I am attempting to use wildcards to eliminate certain filetypes (otherwise the archive gets too large). So I am looking for something along these lines. tar -cf archive.tar * <minus all *.rst... (5 Replies)
Discussion started by: C3000
5 Replies

6. UNIX for Advanced & Expert Users

Wildcards

These 2 websites do a GREAT job of explaining different types of wildcards. I learned about the categories of characters which I never knew about at all. GNU/Linux Command-Line Tools Guide - Wildcards GREP (1 Reply)
Discussion started by: cokedude
1 Replies

7. Shell Programming and Scripting

Perl - grep issue in filenames with wildcards

Hi I have 2 directories t1 and t2 with some files in it. I have to see whether the files present in t1 is also there in t2 or not. Currently, both the directories contain the same files as shown below: $ABC.TXT def.txt Now, when I run the below script, it tells def.txt is found,... (5 Replies)
Discussion started by: guruprasadpr
5 Replies

8. Shell Programming and Scripting

Grep wildcards

Hi all I want to search for number in file presented with wildcard as shown below. cat file.txt 1405 1623 1415 ....... ....... How to search for the number 141526 for example? If the number exist print "Number 141526 exist" if no, print "The number not exist" Thank you in advance. (3 Replies)
Discussion started by: vasil
3 Replies

9. UNIX for Dummies Questions & Answers

[Solved] Wildcards used in find, ls and grep commands

Platforms : Solaris 10 and RHEL 5.6 I always get double quotes , single quotes and asteriks mixed up for find, ls and grep commands. The below commands retrieve the correct results. But , unders stress , I get all these mixed up :mad: .So, i wanted to get a clear picture. Please check if... (7 Replies)
Discussion started by: John K
7 Replies

10. Shell Programming and Scripting

Grep multiple patterns that contain wildcards

job_count=`grep -e "The job called .* has finished | The job called .* is running" logfile.txt | wc -l` Any idea how to count those 2 patterns so i have a total count of the finished and running jobs from the log file? If i do either of the patterns its works okay but adding them together... (8 Replies)
Discussion started by: finn
8 Replies
PMPARSECTIME(3) 					     Library Functions Manual						   PMPARSECTIME(3)

NAME
__pmParseCtime - convert ctime(3) string to tm structure C SYNOPSIS
#include <pcp/pmapi.h> #include <pcp/impl.h> int __pmParseCtime(const char *string, struct tm *rslt, char **errmsg); cc ... -lpcp DESCRIPTION
__pmParseCtime reverses the asctime(3C) function. It accepts a string specifying a time, and fills in the given tm structure. Either a fully specified asctime(3C) string like "Mon Mar 4 13:07:47 1996" or a partially specified time like '1996", "Mar 1996", "Mar 4 1996", "Mar", "13:07:47", "13:07", "Mar 4 13:07:47",... is accepted. In addition, the seconds component may be a floating point number, for example "13:07:47.5". The 12 hour clock is also supported, so "13:07" and "1:07 pm" are equivalent. __pmParseCtime returns 0 if successful. It returns -1 and a dynamically allocated error message string in errmsg, if the given string does not parse. Be sure to free(3C) the error message string. The tm structure returned in rslt should only be used as an argument to the __pmConvertTime function, as it contains encoded information that will only be correctly interpreted by __pmConvertTime. SEE ALSO
PMAPI(3), pmParseInterval(3), __pmConvertTime(3) and __pmParseTime(3). Performance Co-Pilot PCP PMPARSECTIME(3)
All times are GMT -4. The time now is 02:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy