sed change in all files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sed change in all files
# 1  
Old 11-06-2012
sed change in all files

I have a list of property file can each file has name=value kind of key value pair
can replace all = with say ; in each file using sed or any other command
# 2  
Old 11-06-2012
Can you give example on input and desired output.
# 3  
Old 11-06-2012
You need to provide more details (i.e. how are the property files named), but after consulting my crystal ball try this (you need to define the filespec for identifying the files):
Code:
ls property_file_spec | while read filename
do
  sed 's/=/;/' "$filename" > "$filename.out"
done

If your list of files is in a file:
Code:
while read filename
do
  sed 's/=/;/' "$filename" > "$filename.out"
done < filename_containing_a_list_of_files

# 4  
Old 11-07-2012
THank you so much it helped a lot

I was able to do that but i have some unwanted lines in a file

i just want line that have a pattern , below is the file
Code:
#Generated by ResourceBundle Editor
# en Resource Bundle
#
# filename: FormsNRefsPortletResource_en.properties
# Portlet Info resource bundle example
Matches , \u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A
Select , \u0E40\u0E25\u0E37\u0E2D\u0E01
choice1Label , \u0E40\u0E02\u0E49\u0E32\u0E23\u0E31\u0E1A\u0E01\u0E32\u0E23\u0E23\u0E31\u0E01\u0E29\u0E32

desired file should be like
Code:
Matches , \u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A
Select , \u0E40\u0E25\u0E37\u0E2D\u0E01
choice1Label , \u0E40\u0E02\u0E49\u0E32\u0E23\u0E31\u0E1A\u0E01\u0E32\u0E23\u0E23\u0E31\u0E01\u0E29\u0E32


that i want lines whic have \u0E15 these kind of stsring others i want to delete

Last edited by Franklin52; 11-07-2012 at 09:51 AM.. Reason: Please use code tags for data and code samples
# 5  
Old 11-07-2012
Display lines that have a \u in them:
Code:
grep '\\u' filename

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

File name change with sed

I have a bunch of text files like this: Sample_S1_L001_R1.txt Sample_S10_L001_R1.txt Sample_S11_L001_R1.txt I am using the following script to add a 0 to those files with a single digit after the S: ls *.txt | sed 's/\(.*_S\)\(_.*\)/mv & \10\2/' | sh And then the following script to... (4 Replies)
Discussion started by: Xterra
4 Replies

2. Shell Programming and Scripting

sed command: change only twice

Hello, I recently sought help on another thread about how to prefix 2 words in a file with 'pack/'. This is the command: sed --in-place 's/"\(libraries\|objects\)"/"pack\/\1"/g' Background: I have a .json file with the word 'libraries' and 'objects' in it. However, 'libraries' occurs twice;... (6 Replies)
Discussion started by: AJ Ruckman
6 Replies

3. Shell Programming and Scripting

sed colour change

Hi, I am trying to write a script which will email a backup report from the server, The contents of the email will be: ---------------------- ---- -- ---- ----- ---- ------- ---- ------- ------- | | | | |Chnge|Wkng| | | | | | ... (6 Replies)
Discussion started by: Bdoydie
6 Replies

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

5. 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... (0 Replies)
Discussion started by: ust3
0 Replies

6. Shell Programming and Scripting

sed change text

Hello, I have sed to change improperly entered email address such as: blank@blank.co --> blank@blank.com (it should be) I am using this: sed 's/blank.co/blank.com/g' Problem is it makes good ones already blank.com becomes blank.comm which is incorrect..... It should only match *@.co... (3 Replies)
Discussion started by: holyearth
3 Replies

7. UNIX for Dummies Questions & Answers

Change one column using sed??

Is there way to use sed to change only one occurence in a colon separated line? I would like to change a file from *:*:rex:rex *:*:simon:rex to *:*:rex:mabry *:*:simon:rex (2 Replies)
Discussion started by: rexmabry
2 Replies

8. Shell Programming and Scripting

How to change ip using awk or sed .

How to change ip using awk or sed . #cat /etc/hosts 10.151.5.1 server1 10.151.5.2 server2 10.151.5.3 server3 10.151.5.4 server4 10.151.5.5 server5 Output: 10.151.5.1 server1 10.181.5.2 server2 10.151.5.3 server3 10.181.5.4 server4 10.181.5.5 server5 (9 Replies)
Discussion started by: kenshinhimura
9 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

How to change this file with SED?

I have a file like below: I want to delete the rows which begining with "BC" "CD" and "TY" . then change every fields into one row like this at last delete the head words : USing awk to change it is not hard. I want to know how to do this work using SED ? Thank you! ... (4 Replies)
Discussion started by: bejgirl
4 Replies
Login or Register to Ask a Question