...
Hi Tyler, once i execute the command, it just sits and nothing happens.
I would also want to inform that there are 2 files from todays date in the same folder. They both are duplicates of each other. I wouldnt care which one does the command read, it can be either of the two. They both however have the same naming convention but are named differently.
I've cooked up a testcase that simulates the "2 file" scenario. Of course, the files cannot have the same name, and I am assuming that the 5 digit random number between the date format and the ".txt" extension is different between their names.
In that case, the ls -1 and the subsequent pipeline to grep will just print the lines from both files that have "lostER" in them. See below -
But you say that it just sits there and nothing happens.
Are you saying that the control does not return to the shell's dollar ($) prompt ?
The only thing I can think of then is that your files are huge and the grep is still working and taking its own time.
How big are the files ?
How long does it take to grep a hard-coded file name ? That is -
Again, how long does the left part of the pipeline take ? That is -
By testing individual commands, you should be able to figure out the exact process that's hogging up all the time.
Hi tyler_durden, you were right the files were almost 100 MB in size and constantly increasing. I just ran the command now when the file is small and it works like a charm! Thank you so much!
I have a question: How do i define more than one word in the grep command? I did this:
ls -1 ERProcessBD`date '+%m%d%Y'`*.txt | xargs grep "lostER", "SystemOff"
and u may have many of them with 06042010 common in them.
so if you are looking for a pattern you want in all the files generated today( which according to you would have a pattern of date +%d%m%Y in there file name.
Then i would suggest you run the command
grep Hi "desired pattern" *`date +%d%m+Y`*
I am running RHEL 5 and i actually simulated what you said
I have a file comp.pkglist which mention package version and release . In 'version change' and 'release change' line there are two versions 'old' and 'new' Version Change: --> Release Change: -->
cat comp.pkglist
Package list: nss-util-devel-3.28.4-1.el6_9.x86_64
Version Change: 3.28.4 -->... (1 Reply)
Hi,
I have a list of zipped files. I want to grep for a string in all files and get a list of file names that contain the string. But without unzipping them before that, more like using something like gzcat.
My OS is:
SunOS test 5.10 Generic_142900-13 sun4u sparc SUNW,SPARC-Enterprise (8 Replies)
I am attempting to grep an exact string from a series of files within a directory and append that output to the filename when it is present in the file. I've been after this all day with no luck. Thanks for your help in advance :wall:. (4 Replies)
Hi All,
I am new to shell srcipting.
Problem :
I need to write a script which copy the log files from /prod/logs directory based on todays date like (Jul 17) and place it to /home/hzjnr0 directory and then search the copied logfiles for the string "@ending successfully on Thu Jul 17". If... (2 Replies)
Hi ! there
can you please tell me how to get full files having today date like
if i have files like this(below) , i want to grep only sra + today's date + what ever thing is there after date .
grep `sra*$date*.csv` >>> i tried this one but its not working .
sra28-08-2011xyz.csv... (1 Reply)
Hi Friends,
How to list todays file from a directory listing of files for amny dates.
I tried with the following options but not working :
find . -name "esi01v*" -mtime 1 -ls
find . -name "esi01v*" -ctime 1 -ls
find . -name "esi01v*" -mtime 1
Please advise (19 Replies)
What i'm trying to do is to use grep to search through a few files for a selected daemon and only report on today's date.
I think I got it sorted apart from in the txt file the date has 2 gaps between the month and the day, and the way I have the date format only puts in one gap any help to get... (3 Replies)
i want to delete the time stamp from the file which have a date of yester day
640878 Nov 6 09:08 fbres.01.20031106:09:08:30
here is what my ls -lt command shows in current directory
it want it to be
640878 Nov 6 09:08 fbres.01.20031106
thanks (5 Replies)