Reputation: 1
Can any one please help me for below problem
I have a text file in below format and i want to insert a word in a specific field and i want to save that file in shell script with out disturb any thing in the file.
Ex:
cat sample.txt
name=xxxxxx
age=45
gender=femal
college=XXXXXX
class=b1
section=h2
like that
I want to insert in place of XXXXX some word.
Is it possible or not ?
Upvotes: 0
Views: 2413
Reputation: 1
Another option
sed -i '/^college=/ccollege=some word' sample.txt
Result
name=xxxxxx age=45 gender=femal college=some word class=b1 section=h2
Upvotes: 0