The difference between G (global) and% in Vim:
G: The Global
s/pattern/replacement/: Replace each pattern that appears in the line
G/pattern/s/pattern/replacement/g: The G at the beginning is a global command, which means that all rows that match the address are changed. The G at the end is a flag that means changing each on one line.
grep in Linux = g/rep/p
%: represents each line of the file itself
% = = g/.*/
G to work with pattern/pattern/to represent all parts of a range (one line or whole text) that match that pattern
G/pattern/means that for all rows that match the address,/pattern/ means that the first line of S/pattern/replacement/that matches this addressmeans replacing only the first one in the row, s/pattern/ Replacement/g means replacing all of the matches in the line
%s/pattern/replacement = = G/.*/s/pattern/replacement
g/.*/: For all lines that have any number of arbitrary characters
%: All lines of this file
Vim g and% difference