Skip to content

ryuichiueda/opy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

5ff17ec · Nov 1, 2019
Aug 30, 2019
Sep 29, 2019
Aug 29, 2019
Sep 10, 2019
Oct 20, 2019
Nov 1, 2019
Sep 10, 2019
Nov 1, 2019

Repository files navigation

opy: onelinerers' Python

a Python wrapper that works like AWK or rb command

Build Status

example of use

$ seq 3 | opy '[math.sin(F1)]'
0.8414709848078965
0.9092974268256817
0.1411200080598672

install

make

The opy file and its manual are copied to /usr/local/bin/ and /usr/local/share/man/man1/ respectively with the following command.

$ sudo make install

homebrew

$ brew tap ryuichiueda/oneliner-python
$ brew install oneliner-python

options

  • --help: show help
  • -m <modules>: load modules
  • -s: string mode
    • prohibit automatic number conversions.
  • -i, -o: input/output field separator
$ echo '1,2,3,4,5' | opy -i , '[F2]'
2
$ echo '1,2,3,4,5' | opy -i , -o x '[F2,F3,F4]'
2x3x4
  • -I: regex input field separator
$ echo a33b313c | tr ' ' , | opy -I '\d+' '[*F[1:]]'
a b c