Skip to content

Instantly share code, notes, and snippets.

@bkamapantula
Created October 29, 2011 02:16
Show Gist options
  • Save bkamapantula/1324004 to your computer and use it in GitHub Desktop.
Save bkamapantula/1324004 to your computer and use it in GitHub Desktop.
Reading text files line by line in AWK - Day 8
BEGIN{
# Defining variables
arr_index = 0;
arr_max = 4;
}
{
# Stores first and second columns respectively for each row
col1[arr_index] = $1;
col2[arr_index] = $2;
arr_index += 1;
}
END{
for(arr_index = 0; arr_index < arr_max; arr_index++)
{
printf("Column 1 Values = %d, Column 2 = %d\n", col1[arr_index], col2[arr_index]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment