changes values in a file


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users changes values in a file
# 1  
Old 03-03-2011
changes values in a file

search and replace the new values in file

abc/xxx/456/desc_1 int integer = 4400000
acc/xxx/456/rss int integer = 400
abc/xxx/123/data_2 int integer = 5000000
acc/xxx/456/rss int integer = 400
abc/xxx/789/data_3 int integer = 1000000
acc/xxx/456/rss int integer = 400


I need to change the 7 digit numeric values in a file to default value. example 10000

output should be
abc/xxx/456/desc_1 int integer = 10000
acc/xxx/456/rss int integer = 400
abc/xxx/123/data_2 int integer = 10000
acc/xxx/456/rss int integer = 400
abc/xxx/789/data_3 int integer = 10000
acc/xxx/456/rss int integer = 400

Regards
Bala
# 2  
Old 03-03-2011
Code:
sed '/rss/!s/\(integer = \)[0-9]*$/\110000/g'   yourfile

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Taking key values from one file and extracting values from another file

Hi, I have two files with values in both. File1: cat 2 3 dog 4 5 elephant 6 7 camel 2 3 File2: ----+--gkf;ajf= ---+---- +----- cat -------=----+ 3 | 4 ----- dog ------++-- 5 | 9 ----++-- elephant | 5 | 7 ---++ camel ------ ++++_---- || 8 | 9 I want the final file as: cat 4... (1 Reply)
Discussion started by: npatwardhan
1 Replies

2. UNIX for Dummies Questions & Answers

Reading Xml file and print the values into the text file in columnwise?

hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file <sequence> <Filename>aldorzum.doc</Filename> <DivisionCode>US</DivisionCode> <ContentType>Template</ContentType> <ProductCode>VIMZIM</ProductCode> </sequence>... (4 Replies)
Discussion started by: sravanreddy
4 Replies

3. Shell Programming and Scripting

awk file to read values from Db2 table replacing hard coded values

Hi, I want to replace a chain of if-else statement in an old AWK file with values from Db2 table or CSV file. The part of code is below... if (start_new_rec=="true"){ exclude_user="false"; user=toupper($6); match(user, "XXXXX."); if (RSTART ==2 ) { ... (9 Replies)
Discussion started by: asandy1234
9 Replies

4. Shell Programming and Scripting

Read record from the text file contain multiple separated values & assign those values to variables

I have a file containing multiple values, some of them are pipe separated which are to be read as separate values and some of them are single value all are these need to store in variables. I need to read this file which is an input to my script Config.txt file name, first path, second... (7 Replies)
Discussion started by: ketanraut
7 Replies

5. Shell Programming and Scripting

Replace values in a file with values from another file

Hi, I have 2 input files: File 1: echo Name > create_Name.txt echo Group /dir/group, Name >> create_Name.txt File 2: Name AAA BBB CCC group A B C dir A1 B1 C1 ................................ Need to replace the contents of File 1 with column 2, 3 & 4 values of File 2... (8 Replies)
Discussion started by: gctex
8 Replies

6. Shell Programming and Scripting

Referencing file for values and referencing another file to replace values

Hi I have a file which has values in each line: MP304,d40000 MP310,ff0000 etc I have another file which as the first value in it and is unique in the file(not repeated). I need to replace a string with the second value above. The second file contents is as follows:(snippet) <g ... (12 Replies)
Discussion started by: majikins
12 Replies

7. Shell Programming and Scripting

Compare values in two files. For matching rows print corresponding values from File 1 in File2.

- I have two files (File 1 and File 2) and the contents of the files are mentioned below. - I am trying to compare the values of Column1 of File1 with Column1 of File2. If a match is found, print the corresponding value from Column2 of File1 in Column5 of File2. - I tried to modify and use... (10 Replies)
Discussion started by: Santoshbn
10 Replies

8. Shell Programming and Scripting

remove values of a file one by one from 2nd file and then print the remaining values of 2nd file

Hi all, I have 2 files. One contains only 1 column and other one contains 2 columns, let say 1_col.txt and 2_col.txt respectively. Here, I will try to explain with an example. Input files : 1_col.txt 2_col.txt a a b x a c p ... (5 Replies)
Discussion started by: AshwaniSharma09
5 Replies

9. Shell Programming and Scripting

Replacing values in a file based on values in another file

Hi I have 2 files:- 1. List of files which consists of names of some output files. 2. A delimited file; delimted by "|" I want to replace the value of the $23 (23rd column) in the delimited file with name in the first file. It is always position to position. Meaning first row of the first... (5 Replies)
Discussion started by: pparthiv
5 Replies

10. Shell Programming and Scripting

PERL:How to convert numeric values txt file to PACKED DECIMAL File?

Is there any way to convert numeric values txt file to PACKED DECIMAL File using PERL. Regards, Alok (1 Reply)
Discussion started by: aloktiwary
1 Replies
Login or Register to Ask a Question