Sponsored Content
Top Forums Shell Programming and Scripting Need to replace the date inside a node of several rdf files Post 302870827 by Ribosome on Tuesday 5th of November 2013 01:29:48 AM
Old 11-05-2013
Need to replace the date inside a node of several rdf files

Hi,
I have a rdf zip file. This zip file consists of several *.rdf files.
I need to replace the date (this is different for each rdf) inside the node "Date_de_Publication_Periodique" of these rdf files.
e.g.,
Code:
 
awk '/Date_de_Publication_Periodique/ && /XMLSchema#date/' MM_NN-A1B1C1_ABC.rdf

gives:
Code:
 
 <j.1:Date_de_Publication_Periodique rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2013-10-30</j.1:Date_de_Publication_Periodique>

I need to replace this date: 2013-10-30 with my desired date.
With the shell script, I want to unzip the file, take out the strings (from the rdfs) for the mentioned node containing the date and replace it with my desired date (fixed date) for all the rdf files and then zip it back.
Following are my failed attempts:

Code:
awk '/Date_de_Publication_Periodique/ && /XMLSchema#date/' MM_NN-A1B1C1_ABC.rdf | awk '{gsub(/\d{4}\-\d{2}-\d{2}/,"JJJJJJ"); print}'

Code:
 
awk '/Date_de_Publication_Periodique/ && /XMLSchema#date/' MM_NN-A1B1C1_ABC.rdf | awk '{sub(/\d{4}\-\d{2}-\d{2}/,"JJJJJJ"); print }'

Need suggestions.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to read i-node informations (date of creation)

Hi, I'm looking for a way to get the date of creation for a file. Is it possible ? I know that these informations are in the i-node but I don't know how to access them (if the 'find' command can do it with option -ctime, I have reasons to believe in it). Thanks for helping me ! (1 Reply)
Discussion started by: mullmafr
1 Replies

2. Shell Programming and Scripting

compare date and time inside data of two files

i have two files with identical no of columns. 6th columns is date (MM/DD/YY format) and 7th columns is time (HH:MM:SS) format. I need to compare these two vaules and if the date & time is higher than fileA, save it on fileC; if the value is lower, then save it on fileD CONDITIONS... (7 Replies)
Discussion started by: ajiwww
7 Replies

3. Shell Programming and Scripting

ksh compare dates INSIDE a file (ie date A is > date B)

In KSH, I am pasting 2 almost identical files together and each one has a date and time on each line. I need to determine if the first instance of the date/time is greater than the 2nd instance of the date/time. If the first instance is greater, I just need to echo that line. I thought I would... (4 Replies)
Discussion started by: right_coaster
4 Replies

4. Shell Programming and Scripting

Find Node and replace line(s) preceding in xml file

Hello, I have an xml file whose contacts are like below: <Node>Apple <B>Value1</B> <B>Value2</B> <B>Value3</B> </Node> <Node>Mango <B>Value1</B> <B>Value2</B> <B>Value3</B> </Node> <Node>Apple <B>Value1</B> <B>Value2</B> <B>Value3</B> </Node> <Node>Bannana (3 Replies)
Discussion started by: umarsatti
3 Replies

5. Shell Programming and Scripting

Searching for unknown date inside the file and replace to new date

Hello, Iam a newbies to Shell scripting. Iam trying to replace the date inside the file to new date. is there anyway that we can just use the pattern to search as "..." I have many files want to replace with the same date, and each file contains different date. Thanks for your help. ... (2 Replies)
Discussion started by: Daro
2 Replies

6. Shell Programming and Scripting

Find week of the year for given date using date command inside awk

Hi all, Need an urgent help on the below scenario. script: awk -F"," 'BEGIN { #some variable assignment} { #some calculation and put values in array} END { year=#getting it from array and assume this will be 2014 month=#getting it from array and this will be 05 date=#... (7 Replies)
Discussion started by: vijaidhas
7 Replies

7. Shell Programming and Scripting

Extract Oracle sql queries from .fmb and .rdf files

Hi all, Thanks for your time! Regards, (1 Reply)
Discussion started by: a1_win
1 Replies

8. UNIX for Beginners Questions & Answers

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 $ cat temp.txt RTG*888*TD8*20180201~... (1 Reply)
Discussion started by: Shankar455
1 Replies

9. UNIX for Beginners Questions & Answers

Find all .sh files in file system and need to replace the string inside .sh files

Hi All, I need to write a script to find all "*.sh" files in /home file system and if any string find "*.sh" files with the name vijay@gmail.com need to replace with vijay.bhaskar@gmail.com. I just understood about the find the command to search .sh files. Please help me on this. find / -name... (3 Replies)
Discussion started by: bhas85
3 Replies

10. UNIX for Beginners Questions & Answers

How to replace a parameter(variable) date value inside a text files daily with current date?

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)
Discussion started by: pradeepp
1 Replies
ldns(3) 						     Library Functions Manual							   ldns(3)

NAME
ldns_rdf_new, ldns_rdf_clone, ldns_rdf_new_frm_data, ldns_rdf_new_frm_str, ldns_rdf_new_frm_fp, ldns_rdf_free, ldns_rdf_deep_free, ldns_rdf_print- SYNOPSIS
#include <stdint.h> #include <stdbool.h> #include <ldns/ldns.h> ldns_rdf* ldns_rdf_new(ldns_rdf_type type, size_t size, void *data); ldns_rdf* ldns_rdf_clone(const ldns_rdf *rd); ldns_rdf* ldns_rdf_new_frm_data(ldns_rdf_type type, size_t size, const void *data); ldns_rdf* ldns_rdf_new_frm_str(ldns_rdf_type type, const char *str); ldns_status ldns_rdf_new_frm_fp(ldns_rdf **r, ldns_rdf_type type, FILE *fp); void ldns_rdf_free(ldns_rdf *rd); void ldns_rdf_deep_free(ldns_rdf *rd); void ldns_rdf_print(FILE *output, const ldns_rdf *rdf); DESCRIPTION
ldns_rdf_new() allocates a new rdf structure and fills it. This function DOES NOT copy the contents from the buffer, unlinke ldns_rdf_new_frm_data() type: type of the rdf size: size of the buffer data: pointer to the buffer to be copied Returns the new rdf structure or NULL on failure ldns_rdf_clone() clones a rdf structure. The data is copied. rd: rdf to be copied Returns a new rdf structure ldns_rdf_new_frm_data() allocates a new rdf structure and fills it. This function _does_ copy the contents from the buffer, unlinke ldns_rdf_new() type: type of the rdf size: size of the buffer data: pointer to the buffer to be copied Returns the new rdf structure or NULL on failure ldns_rdf_new_frm_str() creates a new rdf from a string. type: type to use str: string to use Returns ldns_rdf* or NULL in case of an error ldns_rdf_new_frm_fp() creates a new rdf from a file containing a string. r: the new rdf type: type to use fp: the file pointer to use Returns LDNS_STATUS_OK or the error ldns_rdf_free() frees a rdf structure, leaving the data pointer intact. rd: the pointer to be freed Returns void ldns_rdf_deep_free() frees a rdf structure _and_ frees the data. rdf should be created with _new_frm_data rd: the rdf structure to be freed Returns void ldns_rdf_print() Prints the data in the rdata field to the given file stream (in presentation format) output: the file stream to print to rdf: the rdata field to print Returns void AUTHOR
The ldns team at NLnet Labs. Which consists out of Jelte Jansen and Miek Gieben. REPORTING BUGS
Please report bugs to ldns-team@nlnetlabs.nl or in our bugzilla at http://www.nlnetlabs.nl/bugs/index.html COPYRIGHT
Copyright (c) 2004 - 2006 NLnet Labs. Licensed under the BSD License. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. SEE ALSO
ldns_rdf. And perldoc Net::DNS, RFC1034, RFC1035, RFC4033, RFC4034 and RFC4035. REMARKS
This manpage was automaticly generated from the ldns source code by use of Doxygen and some perl. 30 May 2006 ldns(3)
All times are GMT -4. The time now is 07:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy