Change the content of files but not change the date


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Change the content of files but not change the date
# 1  
Old 12-17-2012
Change the content of files but not change the date

I have 100 files in a directory , all the files have a word "error" and they are created in different date . Now I would like to change the word from "error" to "warning" , and keep the date of the files ( that means do not change the file creation date after change the word ) , can advise what can I do ?

thanks.

Last edited by Scott; 12-17-2012 at 02:31 PM.. Reason: Double post AFTER receiving a reply in the other thread. Tsch.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to change the file content using some conditions

Hello, I would like to change the content of the file that has few blocks starts with 10 and ends with ";" File1.txt 10 bonuses D 20 MATCHED 30 UPD COL 40 (SOL=30) 20 NOT MATCHED 30 INS COL 40 (SOL=30) ; 10 bonuses D 20 MATCHED 30 UPD COL 40... (5 Replies)
Discussion started by: Mannu2525
5 Replies

2. Shell Programming and Scripting

Change date format in am/pm in csv files using UNIX

Hi All, I'm new to forum good to hear all. I stuck in converting date format in csv file using unix csv file contains as below ,750,0000000000000000GCJR, ,06/22/2016 14:48:44 I want to convert into as below ,750,0000000000000000GCJR, ,06/22/2016 02:48:44 PM Please reply asap..... (22 Replies)
Discussion started by: Raghureds
22 Replies

3. Shell Programming and Scripting

Change the content of files but not change the date

I have 100 files in a directory , all the files have a word "error" and they are created in different date . Now I would like to change the word from "error" to "warning" , and keep the date of the files ( that means do not change the file creation date after change the word ) , can advise what can... (7 Replies)
Discussion started by: ust3
7 Replies

4. Linux

when SCP, does file content change?

Good day to you all, Just want to check here, i know when scping a file, size might change due to space issue. it might sound silly, but does file content get change too? if so, what kind of situation that might be? (1 Reply)
Discussion started by: ahtat99
1 Replies

5. Shell Programming and Scripting

Change file content based on data

I have a Transaction File coming into the system. In this file, in all records the relevant data is as follows- Position 1:10 -> Transaction Code Position 252:255 -> 4 digit business code Now based on these 2 fields I have to alter value in Transaction code (Position 1:10)... (6 Replies)
Discussion started by: varunrbs
6 Replies

6. UNIX for Advanced & Expert Users

To change the colour of the content in email sent through unix

Hi I want to change the color of the email content sent through unix. I tried a lot and left in vain. I heard that it could be done by sending the email as HTML. But I don't how to do it. Can you all share your ideas? ~sakthifire (1 Reply)
Discussion started by: sakthifire
1 Replies

7. Shell Programming and Scripting

How to change a file's content by row?

Greetings. So the question is basically the same as it's in the title. I'd like to write a program that changes a file by rows. So to clarify it. (i know i shouldn't use code,/code here but i would like to separate it) So for example a text file looks like something like this: Happy... (5 Replies)
Discussion started by: buddhist
5 Replies

8. Shell Programming and Scripting

change field content awk

I have a line like this: I want to move HTTP/1.1 200 OK to the next line and put a blank line between the two lines i.e. How can i get it using awk? Thanks in advance (2 Replies)
Discussion started by: littleboyblu
2 Replies

9. Shell Programming and Scripting

how to change the content thru sed.....

Hi Everybody, Another headache form myside, i have a file name noname.txt having content as CS007=NEW and i have to write a scipt which will take the parameters as update,delete... with the 1st field of noname.txt (i.e. here CS007) whose objective is to change the 2nd field of noname.txt... (3 Replies)
Discussion started by: manas_ranjan
3 Replies

10. Shell Programming and Scripting

Mass Change content in all files

Hi, Are there any sample scripts to change content like file paths, profile paths etc., from test version to production , instead of changing one by one, i would like to pass the in file (prod version/Test version) to convert to test or prod verions. any help is appreciated!! ~R (1 Reply)
Discussion started by: terala
1 Replies
Login or Register to Ask a Question
ar(1)							      General Commands Manual							     ar(1)

Name
       ar - archive and library maintainer

Syntax
       ar option [ posname ] archive file ...

Description
       The archiver ar maintains groups of files as a single archive file.  This utility is generally used to create and update library files that
       the link editor uses; however, you can use the archiver for other similar purposes.  This version uses a portable ASCII-format archive that
       you can use on various machines that run UNIX.  If you have an archive that uses an older format, see

Options
       This  section  describes the options and suboptions that you can use with the ar utility.  Suboptions must be specified with options.  Fol-
       lowing is a list and description of the options:

       d      Deletes the specified files from the archive file.

       r      Replaces the specified files in the archive file.  If you use the suboption u with r, the archiver only replaces	those  files  that
	      have  last-modified  dates later than the archive files.	If you use a positioning character (from the set abi) you must specify the
	      posname argument to tell the archiver to put the new files after (a) or before (b or i).	Otherwise, the archiver puts new files	at
	      the end of the archive.

       q      Appends  the specified files to the end of the archive file.  The archiver does not accept suboption positioning characters with the
	      q option.  It also does not check whether the files you want to add already exist in the archive.  Use the q option  only  to  avoid
	      quadratic behavior when you create a large archive piece by piece.

       t      Prints  a  table of contents for the files in the archive file.  If you do not specify any filenames, the archiver builds a table of
	      contents for all files.  If you specify filenames, the archiver builds a table of contents only for those files.

       p      Prints the specified files from the archive.

       m      Moves the specified files to the end of the archive.  If you specify a positioning character, you must also specify the posname  (as
	      in option r) to tell the archiver where to move the files.

       x      Extracts	the  specified	files  from  the  archive.  If you do not specify any filenames, the archiver extracts all files.  When it
	      extracts files, the archiver does not change any file.  Normally, the last-modified date for each extracted file shows the date when
	      someone extracted it; however, when you use o, the archiver resets the last-modified date to the date recorded in the archive.

       s      Makes a symbol definition (symdef file) as the first file of an archive.	This file contains a hash table of ranlib structures and a
	      corresponding string table. The symdef file's name is based on the byte ordering of the hash table and  the  byte  ordering  of  the
	      file's target machine.  Files must be consistent in their target byte ordering before the archiver can create a symdef file.  If you
	      change the archive contents, the symdef file becomes obsolete because the archive file's	name  changes.	 If  you  specify  s,  the
	      archiver	creates the symdef file as its last action before finishing execution.	You must specify at least one other archive option
	      (m, p, q, r, or t) when you use the s option.  For UMIPS-V, archives include member objects based on  the  definition  of  a  common
	      object only.  For UMIPS-BSD, they define the common object, but do not include the object.

       v      Gives  a	file-by-file description as the archiver makes a new archive file from an old archive and its constituent files.  When you
	      use this option with t, the archiver lists all information about the files in the archive.  When you use this  option  with  p,  the
	      archiver precedes each file with a name.

       c      Suppresses  the  normal message that the archiver prints when it creates the specified archive file.  Normally, the archiver creates
	      the specified archiver file when it needs to.

       l      Places temporary files in the local directory.  If the l option is not used then the value of the  environment  symbol,  TMPDIR,	is
	      used  as the directory for temporary files.  If TMPDIR is not defined or if the directory it references is not writable then /tmp is
	      used.

       The suboptions do these things:

       a      Specifies that the file goes after the existing file (posname).  Use this suboption with the m or r options.

       b      Specifies that the file goes before the existing file (posname).	Use this suboption with the m or r options.

       i      Specifies that the file goes before the existing file (posname).	Use this suboption with the m or r options.

       o      Forces a newly created file to have the last-modified date that it had before it was extracted from the archive.	Use this suboption
	      with the x option.

       u      Prevents	the archiver from replacing an existing file unless the replacement is newer than the existing file.  This option uses the
	      UNIX system last modified date for this comparison.  Use this suboption with the r option.

Restrictions
       If you specify the same file twice in an argument list, it can appear twice in the archive file.

       The o option does not change the last-modified date of a file unless you own the extracted file or you are the superuser.

       This command truncates filenames to 15 characters.

Files
       /tmp/v*	 temporaries

See Also
       lorder(1), ld(1), odump(1), ranlib(1), ranhash(3x), ar(5), arcv(8)

								       RISC								     ar(1)