Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [sectionA]
- url = value1
- username = value2
- password = value3
- [sectionC]
- url = value1
- username = value2
- password = value3
- [sectionB]
- url = value1
- username = value2
- password = value3
- sed '/sectionB/,/[/s/username.*/username = valueX/' input
- awk -vRS='' -vFS='n' -vOFS='n' '
- $1~/sectionB/{
- sub(/=.*$/, "= valueX", $3)
- }
- {
- printf "%snn", $0
- }' input
- sed -E -n '1h;1!H;${;g;s/[sectionB]([^[]*)username = [a-zA-Z0-9_]+/[sectionB]1username = valueX/g;p;}' input.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement