So I have a large file like the following:
RESOURCETAGMAPPINGLIST arn:aws:ec2:us-east-1:XXXXXX:instance/i-XXXXXXXXXXXXXXXXX
TAGS app-name appname1
RESOURCETAGMAPPINGLIST arn:aws:ec2:us-east-1:XXXXXX:instance/i-XXXXXXXXXXXXXXXXX
TAGS app-name appname2
RESOURCETAGMAPPINGLIST arn:aws:ec2:us-east-1:XXXXXX:instance/i-XXXXXXXXXXXXXXXXX
TAGS app-name appname1
..
I only want to modify the line with RESOURCETAGMAPPINGLIST
and print the the other lines w/out modification. Then I want to print only specific fields on the matching like, like below:
arn ec2 us-east-1 XXXXXX
TAGS app-name appname1
arn ec2 us-east-1 XXXXXX
TAGS app-name appname2
arn ec2 us-east-1 XXXXXX
TAGS app-name appname1
..
I was trying using awk gsub command, but really could not get the -F:
part to work out. Any help would be greatly appreciated and it does not matter if it's awk, sed or perl.