Select text between current date and output to new txt file
Hi guys,
brand new to this thread and very very new to UNIX...so go easy please!
Anyway I have a file that looks like this:
Which will follow this formatting throughout.
The current days entries will start with the date followed by >> and end in <<
What I need to do is select the text between these two "strings" and output it to another file.
What I have tried is
(can't seem to get the date to work but ideally I want this included, but for now I am just trying to figure out something that works.)
The problem with this is I think it starts at the beginning and stops once it has hit the first instance of the two strings.....what I need is the last entered "block" of this text to be selected and output to a file that will be overwritten daily.
Is there any way to do this? I have been googling + searching this site all night but either I can't understand the methods or no-one has had this exact issue.
Any help would be greatly appreciated!
Last edited by Scrutinizer; 06-22-2012 at 02:10 AM..
Reason: code tags instead of formatting
The command I am trying to run is being run through the shell command feature in NEdit on a solaris machine...I am guessing this makes this a whole different ball game?
When I enter that code intro the command and run it I get the following:
Sorry for failing to mention this earlier
Last edited by Scrutinizer; 06-22-2012 at 02:17 AM..
Reason: Added code tags ( + Removed image ????? )
Well that's a new one on me -- not familiar with Nedit.
It sounds like a quoting problem, but I don't have access to a Solaris box at the moment, so I cannot poke from that angle. I do know that with solaris' version of awk you'll need to change delete cache to split( "", cache, "." ). It 'empties' the array -- that version of awk doesn't support delete. You also probalby want to use nawk or (I think) /usr/xpg4/bin/awk.
Can you save the awk script to a file, and then try running the file from Nedit? That's probably the only thing I can think to suggest without knowing the Nedit environment.
There are plenty of folks who work on Solaris more regularly than I do -- be patient I'm sure one of them will offer something that might be of more help.
Somehow that awk code is not protected from the shell, because it does not get run as awk code but it is run by the shell. Those are shell error messages, not awk...
It may be that every line is interpreted as separate (because the first error messages says "Unmatched' .
Does it do this also with this alternative one-liner?
S.
Last edited by Scrutinizer; 06-22-2012 at 11:08 AM..
This User Gave Thanks to Scrutinizer For This Post:
Hello All,
we what we call a parameter file (.txt) where my application read dynamic values when the job is triggered, one of such values are below:
abc.txt
------------------
line1
line2
line3
$$EDWS_DATE_INSERT=08-27-2019
line4
$$EDWS_PREV_DATE_INSERT=08-26-2019
I am trying to... (1 Reply)
We want to call a parameter file (.txt) where my application read dynamic values when the job is triggered, one of such values are below:
abc.txt
------------------
Code:
line1
line2
line3
$$EDWS_DATE_INSERT=08-27-2019
line4
$$EDWS_PREV_DATE_INSERT=08-26-2019
I am trying to write a... (3 Replies)
Dear all,
I have a huge txt file (DATA.txt) with the following content . From this txt file, I want the following output using some shell script.
Any help is greatly appreciated.
Greetings,
emily
DATA.txt (snippet of the huge text file)
407202849... (2 Replies)
so...
Lets assume I have a text file.
The text file contains multiple "#" symbols.
I want to replace all thos "#"s with a STRING using DOS/Batch
I want to add a certain TEXT to the end of each line.
How can I do this WITHOUT aid of sed, grep or anything linux related ? (1 Reply)
I want to add/append the info in the following format to my.txt file.
20130702|abcd20130702.txt FN|SN|DOB
I tried the below script but it throws me some exceptions.
<#!/bin/sh
dt = date '+%y%m%d'members;
echo $dt+|+members+$dt;
/usr/bin/awk -f
BEGIN { FS="|"; OFS="|"; } { print... (6 Replies)
Hi guys,
Just want to ask how can I make a script that will perform like this.
1. Execute the command
2. Then the output of the command will be redirected to a file
2. The file that has been created will have a date on it equivalent to the date and time it was created (or maybe after the... (5 Replies)
Hi Guys,
Anyone who knows how to compare the current date with the a file containing a date, say for example I have a file that looks like this:
Command was launched from partition 0.
------------------------------------------------
Executing command in server server6
Fri Dec 16... (7 Replies)
I have multiple txt files which begin with the word "orders" in folder C:\source. I need to move the files to folder C:\dest and rename them to "process_<date>_<count>"
So for example , if there are 3 files ordersa.txt , ordersb.txt and ordersc.txt in C:\source , after running the script I want... (7 Replies)
I have multiple txt files which begin with the word "orders" in folder C:\source. I need to move the files to folder C:\dest and rename them to "process_<date>_<count>"
So for example , if there are 3 files ordersa.txt , ordersb.txt and ordersc.txt in C:\source , after running the script I want... (1 Reply)
Hey guy,
how to make bash script to create foo.txt file and add current date into file content and that file always append.
example: today the script run and add today date into content foo.txt
and tomorrow the script will run and add tomorrow date in content foo.txt without remove today... (3 Replies)