Need to replace the date inside a node of several rdf files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need to replace the date inside a node of several rdf files
# 8  
Old 11-06-2013
The sed command will return every line in file, with the desired one modified. If your want only that one line, make it sed -n '/.../p' file
But - didn't you want to zip back the files after modification?
# 9  
Old 11-06-2013
Are you sure you want to output only those lines? How do you intent to change these in the original file and add it back in the zip archive?
# 10  
Old 11-06-2013
Yes sorry! I didnt think about that. I first thought of using sed -i 's//g' file. But that is not possible.

---------- Post updated at 09:32 AM ---------- Previous update was at 09:10 AM ----------

I ran the command suggested by Subbeh and checked the file content this time. The desired line has the date replaced by the required one.


<j.1:Date_de_Publication_Periodique rdf:datatype="http://www.w3.org/2001/XMLSchema#date">JJJJJJ</j.1:Date_de_Publication_Periodique>

So I will have to redirect the result to the file with the same name before zipping it.
# 11  
Old 11-06-2013
Don't! redirect to a tmp file, and then rename that to the original file. Redirecting to the org file will clear that before trying to read it.
# 12  
Old 11-06-2013
Yes, I did the same.

Thank you ! Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question