Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Bash / Shell Scripting (http://www.programmingforums.org/forum26.html)
-   -   updating a text file (http://www.programmingforums.org/showthread.php?t=2522)

ojschubert Feb 28th, 2005 8:11 PM

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

mackenga May 19th, 2005 3:51 PM

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

jim mcnamara Jun 14th, 2005 1:28 PM

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.


All times are GMT -5. The time now is 4:00 AM.

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