forked from colonelpanic/dotfiles
Fix get_cols only prints OFS on final column's output
This commit is contained in:
parent
20c3e2c86f
commit
57ae566ac3
10
dotfiles/lib/get_cols.awk
Normal file → Executable file
10
dotfiles/lib/get_cols.awk
Normal file → Executable file
@ -1,15 +1,15 @@
|
|||||||
#!/usr/bin/env gawk -f
|
#!/usr/bin/env gawk -f
|
||||||
BEGIN{
|
BEGIN {
|
||||||
column_count=split(cols,column_numbers," ");
|
column_count=split(cols,column_numbers," ");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
for(i=1; i<=column_count; i++)
|
for(i=1; i<=column_count; i++) {
|
||||||
if(column_numbers[i] < 0)
|
if(column_numbers[i] < 0)
|
||||||
printf "%s", $(NF + 1 + column_numbers[i])
|
printf "%s", $(NF + 1 + column_numbers[i])
|
||||||
else
|
else
|
||||||
printf "%s", $column_numbers[i]
|
printf "%s", $column_numbers[i]
|
||||||
if(i <= column_count)
|
printf "%s", OFS
|
||||||
printf "%s", OFS
|
}
|
||||||
|
|
||||||
printf "%s", ORS
|
printf "%s", ORS
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user