I have a below values in file.
user1 India GJ 1000 IT contractor
user2 Ind GJ 1001 HR contractor
user3 USA CA 1002 R&D hourly
user4 India TN 1003 R&D fte
user5 Ind KA 1004 FE fte
user6 In GJ 2345 HR hourly
Need to match 3rd column and update 2nd column. I am able to do using below command.
awk -i inplace '/GJ|TN|KA/ {$2="IN"} {print}' filename
output for above command is
user1 IN GJ 1000 IT contractor
user2 IN GJ 1001 HR contractor
user3 USA CA 1002 R&D hourly
user4 IN TN 1003 R&D fte
user1 IN GJ 1000 IT contractor
user5 IN KA 1004 FE fte
user6 IN GJ 2345 HR hourly
But the same does not work when I run over ssh
ssh -q server1 "awk -i inplace '/GJ|TN|KA/ {\$2="IN"} {print}" filename
The output over SSH
user1 GJ 1000 IT contractor
user2 GJ 1001 HR contractor
user3 USA CA 1002 R&D hourly
user4 TN 1003 R&D fte
user1 GJ 1000 IT contractor
user5 KA 1004 FE fte
user6 GJ 2345 HR hourly
not sure what I am missing and why its not working our SSH. I am open for any other solutions.
Thanks.