I have a file which looks like:
NNNP PPZL ZZNN
I would like to replace all the letters to "N" nd have an output like this with the same number of lines as the input: (my file here has 3 line but in reality, my file has thousands of lines)
NNNN NNNN NNNN
Indeed, I can just create a new file with this command:
printf %4s | tr " " "N" > file2.txt yes "$(<file2.txt)" | head -n3
However, does anybody know if there is a more straightforward way to replace all the letters at once and maintain the same matrix of columns and rows?