Saturday, July 14, 2007

cut vs. awk

I have been igoring 'awk' for a long time and rely on 'cut' to extract section of a file for text processing. But, 'cut' is very limited on the delimiters. However, 'awk' has a more friendly delimiter definition. For example,

| cut -d' ' -f 3
will only treat a single white space as the delimiter, but
| awk '{print $3}'
will treat one or more white spaces as the delimiter and help a lot of output formatted using white space instead of TAB.

No comments: