3 ms·
depends upon the usecase, for relatively simple column filtering, substitution, etc, awk script would be briefer than python equivalent and most likely be faste
by asicsp 7y ago
depends upon the usecase, for relatively simple column filtering, substitution, etc, awk script would be briefer than python equivalent and most likely be faster as well
if it becomes lengthy (and again depends on features required), then Python is likely to have inbuilt/3rd-party libraries to make it easier to write and maintain
if it is a question of constructing command line one-liners and using it as a part of other cli tools, then awk wins easily
for example:
awk -F'\\W+' -v OFS=, '{print $NF, $2}' input.txt
prints last column and second column, where non-word characters form the field separator and comma is used as output field separator