Skip to content

Instantly share code, notes, and snippets.

@MikaelFangel
Created February 3, 2023 11:53
Show Gist options
  • Save MikaelFangel/e89298246da839ba92e2f140ad352974 to your computer and use it in GitHub Desktop.
Save MikaelFangel/e89298246da839ba92e2f140ad352974 to your computer and use it in GitHub Desktop.
Print a range of columns in a csv file using awk
#!/usr/bin/awk -f
BEGIN {
FS=",";
first_index = 1;
last_index = 3;
}
{
for(i = first_index; i <= last_index; i++) {
printf("%s\t", $i);
}
printf("\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment