am new to unix, can anyone help me How can i convert xxxx_A to xxxx_B in awk
This changes every "A" to "B": echo "xxxxx_A"| awk ' { gsub("A","B", $0) print $0 } ' and this regular expression changes only the "A" that ends the string: echo "xxxxx_A"| awk ' { gsub("A$","B", $0) print $0 } '
thank for the replay,but when i try like this it give me error #!/bin/awk -f
count=gsub("A$","B", $0)
print countthis right. if it wrong how i write a in this format
thank you
awk: ./Demo4:4: print count
awk: ./Demo4:4: ^ syntax error
this is the error i getting
thank you. i find out what is wrong #!/bin/awk -f
{
gsub ("A$","B", $0)
print $0
}