awk с переменными в условии и в файле перенаправления вывода

Существует игра программирования под названием Базовая война, выпущенная в 1984 с помощью языка Redcode. Много реализаций существуют (редактор). Средство моделирования, привыкшее к сражениям рефери Corewar, называют МАРСОМ, Матрицей элементов памяти Средство моделирования Redcode. Известное средство моделирования pmars. Источник для pmars может быть найден на SourceForge. Можно найти пакет таким как pmars-sdl на хинду, например.

enter image description here

Из страниц справочника:

NAME
       pmars - portable corewar system with ICWS'94 extensions

SYNOPSIS
       pmars [ option ...  ] file1 [ file(s) ]
DESCRIPTION
       pMARS  (portable  Memory  Array Redcode Simulator) is a corewar interpreter with
       multi-platform support.  pMARS currently runs  on  UNIX  systems,  PC/DOS,  VMS,
       Amiga  (AmigaDOS command line), and the Mac.  pMARS implements the ICWS'94 draft
       standard, but can also be used in ICWS'88  mode.  The  base  system  includes  a
       graphical  core display for UNIX (curses, X-windows), PC/linux (svgalib), PC/DOS
       and the Mac (see APPENDIX). A line-oriented debugger  is  included  to  help  in
       writing warriors for the ICWS'94 draft standard.

       pMARS  runs one or more warriors written in Redcode that are provided as file(s)
       on the command line.  Running a single warrior is supported for  debugging.  Two
       warriors  are pitted against each other for standard play, but up to 36 warriors
       can be named for "multi-warrior" core war. If the  warrior(s)  assemble  without
       error  they  are  loaded  into  the  core array and executed in round-robin mode
       starting with the first warrior.  Warrior 1 is loaded starting at core  position
       0,  warrior  2, 3, etc., at either a random or fixed position.  For fairness the
       starting order is rotated after each round.

2
18.03.2015, 15:32
1 ответ

У вас есть различные варианты ...

, чтобы пройти переменные оболочки на awk и использовать их в строке сравнения и позволить оболочку создавать файл:

awk -v chr="$chr" '$1==chr' "$infile" > "exons_${chr}.bed"

, чтобы дополнительно Пусть awk сделает вывод в файл:

awk -v chr="$chr" '$1==chr { print > "exons_" chr ".bed" }' "$infile"
3
27.01.2020, 22:05

Теги

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