How to update copyright header on a folder

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to update copyright header on a folder
# 1  
Old 06-02-2009
How to update copyright header on a folder

I have multiple shell scripts in diffrent folders on server.

Most of them contain copyright information like on the third line

* Copyright 2004, 2005, My Inc. All rights reserved.

I need to change these headers to

* Copyright 2003, 2009, My Inc. All rights reserved.

Most importantly any combination of year 2000 needs to be coverted to 2003, 2009. Is it possible to do this with awk?

Thanks !
# 2  
Old 06-03-2009
With sed you can do something like:

sed '/Copyright  2004, 2005,/Copyright  2003, 2009,/g' file > newfile

With awk:

awk '/Copyright  2004, 2005,/{sub("2004, 2005","2003, 2009")}1' file > newfile

# 3  
Old 06-03-2009
awk 'NR==3{$4="2003,";$5="2009,";} {print}' input_file > output_file

use a loop to do the same for all files.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - How to update header of scripts in one pass - multiline search/replace

Hello. A find command return a list of file. For each fileReplace the content starting with the first "§" (of two) ending with last "ɸ" (of two), regardless of the content ( five lines ) by the following content (exactly) : §2019_08_23§ # # ... (8 Replies)
Discussion started by: jcdole
8 Replies

2. Shell Programming and Scripting

Find header in a text file and prepend it to all lines until another header is found

I've been struggling with this one for quite a while and cannot seem to find a solution for this find/replace scenario. Perhaps I'm getting rusty. I have a file that contains a number of metrics (exactly 3 fields per line) from a few appliances that are collected in parallel. To identify the... (3 Replies)
Discussion started by: verdepollo
3 Replies

3. UNIX and Linux Applications

Script to delete few rows from a file and then update header

HJKL1Name00014300010800000418828124201 L201207022012070228XAM 00000000031795404 001372339540000000000000000000000 COOLTV KEYA Zx00 xI-50352202553 00000000 00000000 G000000000000 00000000 ... (10 Replies)
Discussion started by: mirwasim
10 Replies

4. Shell Programming and Scripting

add header in each file of folder

My files location Dir=/pp/Output/Test/ I have 100 .txt files on above location. I want add header "pt all" on each file. Sample Text file Hi Kalol Jt all q Output i want lt all Kalol Jt all (2 Replies)
Discussion started by: asavaliya
2 Replies

5. UNIX for Dummies Questions & Answers

Merge all csv files in one folder considering only 1 header row and ignoring header of all others

Friends, I need help with the following in UNIX. Merge all csv files in one folder considering only 1 header row and ignoring header of all other files. FYI - All files are in same format and contains same headers. Thank you (4 Replies)
Discussion started by: Shiny_Roy
4 Replies

6. Shell Programming and Scripting

How to update folder name after every 2 month

Hello Guru, I need a logic which can rename my folder after every two month with current time stamp... ex: if folder name is My_Folder_20102011 then after two month it should be My_Folder_20122011 its there any way to get it, please share. :confused: Thanks (1 Reply)
Discussion started by: aks_1902
1 Replies

7. Shell Programming and Scripting

Folder Update Script

Hi, I would like to write a script for send out a notification once a folder has been updated or receive a file. I have folder with name SOURCE,this folder receiving source files from third party vendor in i want a notification mail once the folder updated with some thing or once... (2 Replies)
Discussion started by: koti_rama
2 Replies

8. Shell Programming and Scripting

Renaming all header to specific header pattern

Discussion started by: patrick87
5 Replies

9. Shell Programming and Scripting

awk script to update header record

I am using HP UX and think this may be done with awk but bot sure. I have a file with a several header records and undeneath many detail records I need to put in the header record the number of detail records above this header record and number of detail records below this header record Header... (5 Replies)
Discussion started by: klut
5 Replies

10. Linux

Reading the header of a tar file(posix header)

say i have these many file in a directory named exam. 1)/exam/newfolder/link.txt. 2)/exam/newfolder1/ and i create a tar say exam.tar well the problem is, when i read the tar file i dont find any metadata about the directories,as you cannot create a tar containig empty directories. on the... (2 Replies)
Discussion started by: Tanvirk
2 Replies
Login or Register to Ask a Question

Featured Tech Videos