Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 28th, 2005, 8:11 PM   #1
ojschubert
Newbie
 
Join Date: Feb 2005
Posts: 2
Rep Power: 0 ojschubert is on a distinguished road
updating a text file

Hello

I'm a bit of a newbie so bare with me. I'd like to edit a number in a text doucment. The document looks like this:

row1: 20
row2: 40
row3: 49

I basically just want to be able to change these numbers. So far I've been able to get these numbers into a c-program by calling a shell script that uses grep and gawk. Now based on the results of my c-program I'd like to call another script that modifys the numbers in the txt document. I think I might need to use the grep and gawk again along with sed but am not really sure.

Can someone please tell me how to go about doing this.

Thanks

OJ
ojschubert is offline   Reply With Quote
Old May 19th, 2005, 3:51 PM   #2
mackenga
Professional Programmer
 
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 314
Rep Power: 4 mackenga is on a distinguished road
I'd use sed. See the sed manpage; if you don't have it local, try here: http://www.tu-berlin.de/zrz/dienste/...pages/sed.html
mackenga is offline   Reply With Quote
Old Jun 14th, 2005, 1:28 PM   #3
jim mcnamara
Hobbyist Programmer
 
Join Date: Jun 2005
Location: New Mexico
Posts: 228
Rep Power: 4 jim mcnamara is on a distinguished road
If you tell us how you want modify the numbers - show the starting value and the ending value, then we can help. awk or gawk will do an awful lot for you.
jim mcnamara is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:00 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC