I have many lines with several date and hour format within each line and I need to extract only the dates and hours for each line
In the same order.
Example:
Today 090326 she left the office at 20:00, and tomorrow 20090327 will come at 08:00-->Result=090326 20:00 20090327 08:00
I estudied yesterday 25/03/2009, 1524 and I´ll continue tomorrow 27032009 at 17:30-->Result =25/03/2009 1524 27032009 17:30
If I use grep with something like
I don't get only the dates and hours, only some lines that match with that.
May somebody help me doing a filter in order to extract dates and hours in desired format?
I´ve tryed your solutions and works very nice, only some little thing to fix, because I forget that are some lines that contains some other numbers that aren´t of interest for me, for example:
If the text is like
Day_01 090326 she left the office at 20:00, and tomorrow 20090327 will come at 08:00
your codes show 01 090326 20:00, 20090327 08:00
How to eliminate the numbers of 2 or 1 digit like in the word "Day_01" to obtain only dates and hours?
Day_01 090326 she left the office at 20:00, and tomorrow 20090327 will come at 08:00 -->Result 090326 20:00 20090327 08:00. (without 01)
I´ve tryed a little change follow the sed example with
but this eliminates all numbers, including dates and hours.
# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.5 (Maipo)
I have this script that will monitor filesystems and send me e-amil alerts.
#! /bin/ksh
DIST_LIST=monitor@...com
WORKDIR=/home/monitor
WARNLEVEL=90
MAIL_SUBJ="filesystems monitor on "$(hostname)
... (3 Replies)
Hello friends,I am new to Unix programming.
how do I achieve the following in Unix shell script (I am running ksh on AIX)
extract the number from name of file?
My file format is like "LongFileName-1234.020614-221030.txt"
now I want to extract value which is between (-) hyphen and (.) dot... (4 Replies)
Hello
I have an file with this content
--------------------------------------------
timer
one
timer
two
timer
three
timer
four
timer
five
timer
six
timer
seven
-------------------------------------------
And I want the following output.... (4 Replies)
Hi,
i've a string
/u/user/DTE/T_LOGS/20110622_011532_TEST_11_HD_120/HD/TESi T_11_HD_120/hd-12
i need to get string, like
/u/user/DTE/T_LOGS/20110622_011532_TEST_11_HD_120/HD
the words from HD should get deleted, i need only a string till HD, i dont want to use any built in... (4 Replies)
Hi all,
Looking for suggestions on a better way to sum numbers in a key value pair formated file. What I have works but seems really clunky to me. Any suggestions would be greatly appreciated.
cat test.txt | perl -ne 'm/(M=)(\d+\.?\d?\d?)/ && print "$2\n"' | awk '{ sum+=$1} END {printf... (7 Replies)
I need to extract all the p-value numbers and the rho numbers from a .txt file and write them as coma separated values in a new file. Ideally I would get two files in the end, one for p- values and one for rho. Any suggestions? I appreciate your help!!!
The .txt file looks essentially like this... (5 Replies)
Hi,
I was trying to extract the last word with all numbers using awk. like the below example. I am looking for a pattern using awk.
desired result: (13 Replies)
Hi,
I would want to fetch all the numbers after a word the number of characters could very. how can I do that?
below is the example of the data and the expected output
sample data
03 xxxx occurs 1090 times.
04 aslkja occurs 10 times.
I would want to fetch 10 & 1090 separately. (13 Replies)
Hey all,
I ran some simulations, of which the output is 100s of files. I've used grep to extract the vital information needed from the files. This has made my task somewhat easier. But I still need to perform some mathematical calculations (average and geometrical average) on the results of the... (9 Replies)
Hi all,
Please some help over here. I have a Sales.txt file containing info in blocks for
every sold product in the pattern showed below (only for 2 products).
NEW BLOCK
SALE DATA
PRODUCT SERIAL
79833269999 146701011945004
.Some other data
.Some... (17 Replies)