Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
awk '
FNR==NR {
l = length($0);
if (l > ml) {
ml = l
}
}
FNR!=NR {
while (length(a[FNR]) < ml) {
a[FNR] = a[FNR] " "
}
}
{
a[FNR] = a[FNR] $0
}
END {
for (i = 1; i <= length(a); i++) {
print a[i]
}
}
' \
$1 $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment