Help with Grep Specific Date From One File Into A New One
Hello All,
First post, don't know much about Linux/Unix, but I need some help. Normally, I do grep 'what I'm searching for' FILE > file.txt so I can pull data from one file, and put it into a new one. The issue I am having is with specific dates, since the date field is 4, and it appears elsewhere in the header, it's pulling more dates than what I need/want. I just want specific date (yyyymmdd format) from one file to be put into another file. Most of the command with awk/sed I have seen (I am still not too familiar with these) are just listing, when I need this in a whole new file.
Please be way more specific, supplying sample data containing good and bad examples, if you want more than just generic statements like "Use adequate regex".
Please be way more specific, supplying sample data containing good and bad examples, if you want more than just generic statements like "Use adequate regex".
My manager was able to help me out on this (was in a meeting) so here was what worked:
Thanks, all. This can be closed.
Moderator's Comments:
Please use CODE tags as required by forum rules!
Last edited by RudiC; 02-21-2018 at 09:35 AM..
Reason: Added CODE tags.
AWK can read a file without the need of cat and it appears that there is no need of a regular expression if you know that the fourth field may only contain the number 20180202
That will filter every line of FILE, displaying to screen only those that match.
If you want to save the result in a file fundfile.txt and this file doesn't exist or exist but you want to rewrite it, then you can redirect to it
If the file fundfile.txt exist and you do not want to override its content, then you append to it.
i try to set linux date & time in specific format but it keep giving me error
Example :
date "+%d-%m-%C%y %H:%M:%S" -d "19-01-2017 00:05:01"
or
date +"%d-%m-%C%y %H:%M:%S" -d "19-01-2017 00:05:01"
keep giving me this error :
date: invalid date ‘19-01-2017 00:05:01'
Please use CODE tags... (7 Replies)
I have a log file which have a date and time at the start of every line.
I need to search the log file starting from a specific time to the end of file.
For example:
Starting point: July 29 2018 21:00:00
End point : end of file
My concern is what if the pattern of `July 29 2018 21:00:00`... (3 Replies)
Hello Folks,
I have an requirement, where i need to get total count of the file based on creation date with there filename selected pattern.
Filename: MobileProtocol.20171228T154200.157115.udr
I want to get the count of files created on each day based on a pattern find.
find . -type... (7 Replies)
Hi,
I have log file which rolls out every second which is as this.
HttpGenRequest - -<!--OXi dbPublish--> <created="2014-03-24 23:45:37" lastMsgId="" requestTime="0.0333"> <response request="getOutcomeDetails" code="114" message="Request found no matching data" debug="" provider="undefined"/>... (3 Replies)
let say i have list of file
PermissionsDirectoriesGroupSizeDateDirectory or file
drwx------2users4096Nov 2 19:51mailv
drwxr-s---35www 32768Jan 20 22:39public_htmlt
drwx------ 2 users 4096 Nov 2 19:51 mail
drwxr-s--- 35 www 32768 Jan 20 22:39 public_html
drwxr-s--- 35 www 32768 Jan... (3 Replies)
Hi
My OS is solaris 64 bit 10, I have many files in a logs directory where we recive 40-50 logs every day. i have last 20 days file present in this directory. I want to move each day file to a particulaar directory whose name is appended with the date of file.
eg
Code:
1.txt file... (1 Reply)
Hi everybody,
I'd like to think I've been through the search tool not only on this site, but also on google too, but I haven't been able to find what I was looking for. If I might've missed something on this forum, please slap me in the face with a link that you consider useful for my query :D
... (4 Replies)
I'm trying to figure out how to open and copy all contents of files last modded on aug 14 to one single text file. Also, I'm trying to do this in one command string.
I have
ls -l -R | grep "Aug 1" but all this does is print the -l info with Aug 1 in it.
how can I modify this so that
ls... (3 Replies)
Is there a way to grep only one line from a file listing name of files?
If I use head -1 it's ok(the first line only)
If I use head -2 it's not good because I have already checked the first line.
I'd like something like this:
while test $i -le $max
do
grep "$3" `head -$i temp.txt` >... (4 Replies)