Need to read line by line a file example below and then get only and put it in separate file file 1
1~abc~select col1,col2,col3,col4 from <tablename> where <condition> group by~xyz
2~abc~select col1,col2,col3 from <tablename> where <condition> group by~xyq
3~abc~select col1,col2 from <tablename> where <condition> group by~xyg
new file expecting
1~abc~<condition>~xyz
2~abc~<condition>~xyq
3~abc~<condition>~xyg
is there any simpler way to get this done using shell script.