💻 Software
Is it possible to change the default field separator in awk?
Fresh5 days ago
Mar 15, 20266673 viewsConfidence Score0%
0%
Problem
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: 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…
Error Output
awk 'BEGIN {FS=","}
$2 < 20 {print $1}' myfile.csvUnverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: Is it possible to change the default field separator in awk?
Low Risk
To change awk default field separator, use the option ( being a simple character or a regular expression). You can also change this with the awk internal variable .
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix