sed or awk to change a field in a file
I am new to Linux and I'm trying to learn how to edit files with a script. I created a file called "address". I wrote a script where I ask the user to enter their name, street, zip, and state. I'm using ":" to separate the fields. The format looks like this:
peter parker : 32 : main st : 11111 : FL
clark kent : 134 : rainbow rd : 22222 : MI
I now want to add a feature which allows the user to edit a field on a line and then save it back to the original file. An example would be to change peter parker's house number from 32 to 42. My edit feature would ask the user what name they want to search for and then what is the new house number.
I have a basic understanding of awk and sed. I know awk can list all the columns and sed has a search and replace feature. Any help on this would be greatly appreciated.
|