i need to reformat a file in shell, so i only leave the ‘new line’ before some pattern. Ex:
Input:
Europe First
Asia Second
Africa Third
Australia Fourth
Europe Sixth
Australia Seventh
Europe Eight
America Last
Output:
Europe FirstAsia SecondAfrica ThirdAustralia Fourth
Europe SixthAustralia Seventh
Europe EightAmerica Last
where the pattern is “Europe”
1 Answer