I am trying to remove the last letter in a file and then multiply each line (which contained this letter) by 500. This is what I have:
1499998A
1222222A
1325804A
1254556
1235
9998
777
[FONT="]
cat /tmp/listzz |gawk '{print $4}'|gawk '{gsub(/[A]/, ""); print }
This removes the A but then I can not multiply the lines that had the A with 500.
I was able to pass the file through a variable - var
if [[ "$var" =~ A ]]; then echo "found it";else echo "no";fi
and it will find the A, but I am not sure how to multiply the lines that had the A by 500. I don't want any of the other lines multiplied.
Does someone have a suggestion?
This is what I need:
- find lines with A and delete the A - which is always at the end of file
- then multiply those lines only by 500
- The rest of the lines that don't contain the A should not be multiplied.