Namisto bashismu a externich commandu si myslim, ze by to slo v Posixu.
#!/bin/sh
while read line; do printf "%s\n" "${line#${line%%?????}}"; done < file
Je to psano rychle, ale im hoby to melo fungovat. Porovnavat se mi rychlost nechce. A je mi jedno, kdo co pouzije za shell ;-)
f.
Dekuji za uznani ;-) Posix shell scripting proste vysel z mody a GNU coreutils taky nejsou na kazdem unixu, stejne tak bash. Printf je externi command, ale v mnoha shellech je kvuli rychlosti (dash, bash etc.) stejne jako echo vestavene.
Viz man dash :
In addition to these, there are several other commands that may be builtin for efficiency (e.g. printf(1), echo(1), test(1), etc).
a man bash : SHELL BUILTIN COMMANDS -> printf [-v var] format [arguments]
Posix shell se mi nechce startovat, ale podivam se zitra ... myslim, ze to bude stejne.
Kazdopadne dik, jdu sbirat dalsi negativni body :-D
f.