3
I'm always using awk to manipulate comma separated files, so the first line in my code is always changing the field separator to "," like so:
awk 'BEGIN {FS=","}
$2 < 20 {print $1}' myfile.csv
Is it possible to change awk's defaults so that comma is the default FS? It's not a big problem, but it would just make things a bit neater. I tried googling, but didn't find anything useful; it might be that this isn't possible, but I thought I'd ask!
2Aliases such as this one are dangerous. The risk is that someday you will ask yourself: but why the heck is my awk not splitting using spaces ? – Ouki – 2012-02-15T12:08:53.237
You should name the alias something like
awkc
instead. – glenn jackman – 2012-02-15T14:58:11.650I like the aliasing idea - with @glenn's modification - thanks all! – evsmith – 2012-02-15T17:36:56.853