file:
url: urlvalue
name:
organisation:
word
How can i extract urlvalue and add it to name: so that final output will be.
url: urlvalue
name: urlvalue
organisation:
word
regex to find a pattern and make a duplicate but by editing the first word of pattern eg. in above find for line with ^url below that line add duplicate of the same line but change url: to name:
Also query regarding below: How can i negate multiple regex in awk or sed ?
eg. all lines that dont start with name, organisation, and url ---> apped pass: as prefix to those lines
Tried:
awk '$1 != "url*" && $1 != "name*" && $1 != "organisation*" {$1 = "pass"} {print}'
Also tried:
awk '$1 != "url*" && $1 != "name*" && $1 != "organisation*" {gsub(/^/, pass:, "g", $1) {print}'
Not working
Another Tried solution Works partially
awk '$1 != "url:" && $1 != "name:" && $1 != "organisation:" {print "pass"$0}'
But it outputs only
pass:word
Desired output :
url: urlvalue
name: urlvalue
organisation:
pass:word