UNIX script to replace old date with current date dynamically in multiple files present in a folder
I am trying to work on a script where it is a *(star) delimited file has a multiple lines starts with RTG and 3rd column=TD8 I want to substring the date part and
I want to replace with currentdate minus 15 days. Here is an example. iam using AIX server
I want the output as below by changing date. Please help. I am looking for UNIX script to make it work for all files present in that directory
Thanks in advance
Last edited by vgersh99; 05-02-2019 at 10:37 AM..
Reason: code tags, please!
Hi,
I have a requirement where I need to write the current date to the file.
This remaining content of this file does not change and we use this file to concat with another one.
Only thng is that I need to write the date to say, record number 10 of this file everyday.
Can this be done in... (5 Replies)
Hi,
I have a fixed 4 files in each different directory. The total 17 directories are there each one having 4 files inside it. I need rename all of them with current date. The files formates will be as below:
Folder1:
abc_NOR_xyz_ddmmyyyy.txt
abc_NOR_ghij_ddmmyyyy.txt
Folder2:... (5 Replies)
Hi,
Anybody knows how to get what date was 28 days ago of the current system date through UNIX script.
Ex : - If today is 28th Mar 2010 then I have to delete the files which arrived on 1st Mar 2010, (15 Replies)
Hi Guys,
I have a file with following content
From 20121014 : To 20121014
Number of days : 1
1234
1245
1246
1111
Everyday i run my script i want to modify "To" date on the first line with current date. I have set the current date in script as
RUN_DATE=`date -u +%Y%m%d`
So i want... (9 Replies)
Hi All,
I am new in scripting and working in a project where we have RSyslog servers over CentOS v7 and more than 200 network devices are sending logs to each RSyslog servers. For each network devices individual folders create on the name of the each network devices IP addresses.The main... (7 Replies)
current date command runs well
awk -v t="$(date +%Y-%m-%d)" -F "'" '$1 < t' myname.dat
subtract 30 days fails
awk -v t="$(date --date="-30days" +%Y-%m-%d)" -F "'" '$1 < t' myname.dat
awk command in hp unix subtract 30 days automatically from current date without date illegal option error... (20 Replies)
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)
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)
I Have text like
XXX_20190908.csv.gz need to replace Only date in this format with current date every day
Thanks! (1 Reply)
Discussion started by: yamasani1991
1 Replies
LEARN ABOUT DEBIAN
stag-db
STAG-DB(1p) User Contributed Perl Documentation STAG-DB(1p)NAME
stag-db - persistent storage and retrieval for stag data (xml, sxpr, itext)
SYNOPSIS
stag-db -r person -k social_security_no -i ./person-idx myrecords.xml
stag-db -i ./person-idx -q 999-9999-9999 -q 888-8888-8888
DESCRIPTION
Builds a simple file-based database for persistent storage and retrieval of nodes from a stag compatible document.
Imagine you have a very large file of data, in a stag compatible format such as XML. You want to index all the elements of type person;
each person can be uniquely identified by social_security_no, which is a direct subnode of person
The first thing to do is to build an index file, which will be stored in your current directory:
stag-db -r person -k social_security_no -i ./person-idx myrecords.xml
You can then use the index "person-idx" to retrieve person nodes by their social security number
stag-db -i ./person-idx -q 999-9999-9999 > some-person.xml
You can export using different stag formats
stag-db -i ./person-idx -q 999-9999-9999 -w sxpr > some-person.xml
You can retrieve multiple nodes (although these need to be rooted to make a valid file)
stag-db -i ./person-idx -q 999-9999-9999 -q 888-8888-8888 -top personset
Or you can use a list of IDs from a file (newline delimited)
stag-db -i ./person-idx -qf my_ss_nmbrs.txt -top personset
ARGUMENTS
-i INDEXFILE
This file will be used as the persistent index for storage/retrieval
-r RELATION-NAME
This is the name of the stag node (XML element) that will be stored in the index; for example, with the XML below you may want to use the
node name person and the unique key id
<person_set>
<person>
<id>...</id>
</person>
<person>
<id>...</id>
</person>
...
</person_set>
This flag should only be used when you want to store data
-k UNIQUE-KEY
This node will be used as the unique/primary key for the data
This node should be nested directly below the node that is being stored in the index - if it is more that one below, specify a path
This flag should only be used when you want to store data
-u UNIQUE-KEY
Synonym for -k
-p PARSER
This can be the name of a stag supported format (xml, sxpr, itext) - XML is assumed by default
It can also be a module name - this module is used to parse the input file into a stag stream; see Data::Stag::BaseGenerator for details on
writing your own parsers/event generators
This flag should only be used when you want to store data
-q QUERY-ID
Fetches the relation/node with unique key value equal to query-id
Multiple arguments can be passed by specifying -q multple times
This flag should only be used when you want to query data
-top NODE-NAME
If this is specified in conjunction with -q or -qf then all the query result nodes will be nested inside a node with this name (ie this
provides a root for the resulting document tree)
-qf QUERY-FILE
This is a file of newline-seperated IDs; this is useful for querying the index in batch
-keys
This will write a list of all primary keys in the index
-w WRITER
This format will be used to write the data; can be any stag format (xml, sxpr, itext) - default XML.
Can also be a module that catches the incoming stag event stream and does something with it (for example, this could be a module you write
yourself that transforms the stag events into HTML)
SEE ALSO
Data::Stag
For more complex stag to database mapping, see DBIx::DBStag and the scripts
stag-storenode
selectall_xml
perl v5.10.0 2008-12-23 STAG-DB(1p)