Other way aside from putting more PIPES (|)

I already manage to get the output that i want.. but wat if removing all the pipes and convert it 1 liner with less pipes. My command below can get the ouput that i want. i just want to remove the pipes or less pipes.

#cat file1
us-west-2a running i-3397a421 192-11-1-10.us-west-2.compute.internal 
us-west-2a running i-33af9c21 192-11-1-11.us-west-2.compute.internal 

Command i use:
 cat file1 |awk '{gsub("ip-","",$4)}1'|awk '{gsub("-",".",$4)}1'|awk '{gsub(".us.west.2.compute.internal","\t",$4)}1'

Output:
#cat file1
us-west-2a running  i-3397a421  192.11.1.10        None
us-west-2a running i-33af9c21 192.11.1.11        None

A single awk statement perhaps ? :

awk ' { gsub("ip-","",$4);gsub("-",".",$4);gsub(".us.west.2.compute.internal","\t",$4) } 1'  file1.txt
1 Like

look goods to me.. :slight_smile: