replace item..


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers replace item..
# 1  
Old 09-11-2007
replace item..

Hello,
I have the following basic script which is remove the fielld. How can I replace another value in the field? Thx!!

for file in `cat $listn.txt`
do
get_file -q $file
grep -v '<customer-id>13000</customer-id>' $file > $file.grep
done
echo All processed file done!!

input file:
<customer-id>13000</customer-id>

output file:
<customer-id>2400</customer-id>

happyv

Last edited by happyv; 09-13-2007 at 02:04 AM..
# 2  
Old 09-13-2007
anyone can help????
# 3  
Old 09-14-2007
Try...
Code:
sed 's!<customer-id>13000</customer-id>!<customer-id>2400</customer-id>!' $file > $file.sed

 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash menu item counter

We have a simple menu with prompt of menu numbers to user. It is still under construction. Is there a way to "count" the menu choices so the prompt maximum count can be changed dynamically? See attached TODO note in code read_options(){ local choice # the... (7 Replies)
Discussion started by: annacreek
7 Replies

2. Shell Programming and Scripting

Confused on how to script item

I am working on a script that will parse the /proc/meminfo file and return values. I have been able to pull the MemTotal and MemFree from that file but have stumbled on the next thing I want to do - calculate memory used via subtracting MemFree from MemTotal. Would I do something like - ... (5 Replies)
Discussion started by: flyboynm
5 Replies

3. Shell Programming and Scripting

Reading each item from a formatted file

Hi, I have a file generated like this - 1. Fire SQL and store the formatted output in a temp file echo "select path, empid, age from emp_tbl" | /usr/sql emp_db 2 > count_file | grep vol > tempFile 2. The tempFile looks like this after the above statement /vol/emp1 0732 ... (9 Replies)
Discussion started by: angshuman_ag
9 Replies

4. Solaris

Add item to crontab

hi, how can I add a new value to crontab file using a script not using the command " crontab -e " . ex: echo " 10 10 * * * " >> /var/spoll/cron/crontabs/<username> how can I do that in a correct way?? thanks, (3 Replies)
Discussion started by: Ahmed waheed
3 Replies

5. Shell Programming and Scripting

find an available item in array

Dear all, I'm have a sorted array like this: 177 220 1001 2000 2001 2003 2005 notice that 2002 and 2004 are NOT in array. Then user input a number INPUT, our script should return OUTPUT value like this: if INPUT is not in array => OUTPUT=INPUT if INPUT is in array => OUTPUT is the... (4 Replies)
Discussion started by: fongthai
4 Replies

6. Shell Programming and Scripting

change some record item

Hi all, I have a file with over 10,000 line, but I would like to update/add some code number (such as 062 below) into the line with <phone number> below: 11111<name> john matin <name> 12345<phone number> 123456 <phone number> 34556 <address> 1234 lucky road <address> 11111<name> john... (7 Replies)
Discussion started by: happyv
7 Replies

7. Shell Programming and Scripting

Removing an item from the dock

Hello! I am able to add an item to the dock with this command: defaults write com.apple.dock persistent-apps -array-add... (1 Reply)
Discussion started by: emperorfabulous
1 Replies

8. Shell Programming and Scripting

Skip item by using substring

I have a file contents like this.... item1 item2 #item3 item4 #item5 item6 .... I have a KSH script to read this file into an array. I have a for loop which will read each item... I want to be able to skip those item start with # sign as first character in a if condiction inside the... (2 Replies)
Discussion started by: rwunwla
2 Replies
Login or Register to Ask a Question