Разделить CSV файл на меньшие файлы на основе некоторого условия

Это странно, ящик nrel / CentOS-6.6-x86_64 явно доступен в атласе ( https://atlas.hashicorp.com/nrel/boxes/CentOS-6.6-x86_64 )

какую версию vagrant вы используете? вам нужен бродяга как минимум 1.5, который умеет скачивать ящики с атласа.

вы также можете установить коробку вручную, но соблюдайте имя:

vagrant box add nrel/CentOS-6.6-x86_64 https://atlas.hashicorp.com/nrel/boxes/CentOS-6.6-x86_64/versions/1.0.0/providers/virtualbox.box

1
20.04.2017, 13:22
1 ответ

(gawk)

awk -F"," '{ print $0 >> $4".csv"}' filename

Пример:

-F"," -- Use "comma" field separator (FS) 
$0 -- the whole line of input
$4 -- the 4-th field of line ($NF -- the last field)
>> -- redirection operator, from `info gawk':

'print ITEMS >> OUTPUT-FILE'
  This redirection prints the items into the preexisting output file
  named OUTPUT-FILE.  The difference between this and the single-'>'
  redirection is that the old contents (if any) of OUTPUT-FILE are
  not erased.  Instead, the 'awk' output is appended to the file.  If
  OUTPUT-FILE does not exist, then it is created.
2
27.01.2020, 23:34

Теги

Похожие вопросы