Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Call user defined function from awk Post 303040758 by Neo on Wednesday 6th of November 2019 06:52:04 AM
Old 11-06-2019
You can process your test with PHP or Python, for example, and then call your awk (or any external) function from there.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Nawk user-defined function

HELP!!!! I am in an on-line shell programming class and have a question. Here is the data: Mike Harrington:(510) 548-1278:250:100:175 Christian Dobbins:(408) 538-2358:155:90:201 Susan Dalsass:(206) 654-6279:250:60:50 (There are 12 contribuors total) This database contains names, phone... (1 Reply)
Discussion started by: NewbieGirl
1 Replies

2. Shell Programming and Scripting

awk printf for user defined variables

I am working on a SunFire 480 - uname -a gives: SunOS bsmdb02 5.9 Generic_112233-08 sun4u sparc SUNW,Sun-Fire-480R I am tyring to sum up the total size of all the directories for each running database using awk: #!/usr/bin/ksh for Database in `ps -efl | grep "ora_pmon" | grep -v grep |... (1 Reply)
Discussion started by: jabberwocky
1 Replies

3. Shell Programming and Scripting

need help with User Defined Function

Dear Friends, I need a help regarding User defined function in shell script. My problem is as follows: my_func.sh my_funcI(){ grep 'mystring' I.dat } my_funcQ(){ grep 'mystring' Q.dat } myfuncI myfuncQ But As both the function has same function only the... (11 Replies)
Discussion started by: user_prady
11 Replies

4. Shell Programming and Scripting

Return an array of strings from user defined function in awk

Hello Friends, Is it possible to return an array from a user defined function in awk ? example: gawk ' BEGIN{} { catch_line = my_function(i) print catch_line print catch_line print catch_line } function my_function(i) { print "echo" line= "awk" line= "gawk"... (2 Replies)
Discussion started by: user_prady
2 Replies

5. Shell Programming and Scripting

Call Function in .pm as another user

Hello, I need to call a function which reside in some package moudle (.pm) as another user by using su -. Are anyone know how can I do it? Thanks (1 Reply)
Discussion started by: Alalush
1 Replies

6. UNIX and Linux Applications

strange behavior of PSQL user defined function

Segregated the problematic portion, and showing for your view here., 1. Following is the function definition, create or replace function new_del(id integer) returns void as $$ begin raise info 'dollar :%',$1; delete from testing where id=$1; end ; $$ language 'plpgsql'; ... (1 Reply)
Discussion started by: thegeek
1 Replies

7. Shell Programming and Scripting

How to pass parameter to User defined function in shell script?

Hello, Can anyone guide me tin passing parameters into user defined function of shell script (KSH). Here is my code, InsertRecord() { DB_TBL=$(sqlplus $USERID/$PASSWORD@$DATABASE << EOF set head off set feed off set serveroutput on INSERT INTO TBL1 ( OLD_VAL, NEW_VAL, ... (7 Replies)
Discussion started by: Poonamol
7 Replies

8. Shell Programming and Scripting

User defined functions in awk

Hi; Is der ne to to use user defined functions for the values in awk find $1 -type f -ls | nawk '{{print "|"$3"|"$5"|"$6"|"$8"|"$9"|"$10"|"} for(i=11;i<=NF;i++){printf("%s",$i)}}' In above command i want to append some values returned by user functions on line. thnks; ajay (1 Reply)
Discussion started by: ajaypadvi
1 Replies

9. UNIX for Dummies Questions & Answers

Problem syntax with user-defined function

Hi ! I got a script from Arabic to Roman numeral conversion - .comp.lang.awk, that I would like to modify to apply it on my input file. input ("|"-delimited fields): AAAAAA|1, 10, 13, 14, 25, 60 wanted output: AAAAAA|I, X, XIII, XIV, XXV, LX script.awk: #!/usr/bin/gawk -f ... (11 Replies)
Discussion started by: lucasvs
11 Replies

10. Shell Programming and Scripting

Call function as different user within the script

Hello For HP-UX, ksh shell, is it possible to define functions and call them by another user ? For example <function_name> ( ) { command1 command2 } su - <user> -c <function_name> Or the only option is defining the user in the function itself as follows - <function_name> ( )... (2 Replies)
Discussion started by: atanubanerji
2 Replies
PY.TEST-3(1)							      pytest							      PY.TEST-3(1)

NAME
pytest - pytest usage CALLING PY.TEST-3 THROUGH PYTHON -M PY.TEST-3 New in version 2.0. If you use Python-2.5 or later you can invoke testing through the Python interpreter from the command line: python -m pytest [...] This is equivalent to invoking the command line script py.test-3 [...] directly. GETTING HELP ON VERSION, OPTION NAMES, ENVIRONMENT VARIABLES py.test-3 --version # shows where pytest was imported from py.test-3 --funcargs # show available builtin function arguments py.test-3 -h | --help # show help on command line and config file options STOPPING AFTER THE FIRST (OR N) FAILURES To stop the testing process after the first (N) failures: py.test-3 -x # stop after first failure py.test-3 --maxfail=2 # stop after two failures SPECIFYING TESTS
/ SELECTING TESTS Several test run options: py.test-3 test_mod.py # run tests in module py.test-3 somepath # run all tests below path py.test-3 -k string # only run tests whose names contain a string Import 'pkg' and use its filesystem location to find and run tests: py.test-3 --pyargs pkg # run all tests found below directory of pypkg MODIFYING PYTHON TRACEBACK PRINTING
Examples for modifying traceback printing: py.test-3 --showlocals # show local variables in tracebacks py.test-3 -l # show local variables (shortcut) py.test-3 --tb=long # the default informative traceback formatting py.test-3 --tb=native # the Python standard library formatting py.test-3 --tb=short # a shorter traceback format py.test-3 --tb=line # only one line per failure DROPPING TO PDB (PYTHON DEBUGGER) ON FAILURES Python comes with a builtin Python debugger called PDB. py.test-3 allows one to drop into the PDB prompt via a command line option: py.test-3 --pdb This will invoke the Python debugger on every failure. Often you might only want to do this for the first failing test to understand a certain failure situation: py.test-3 -x --pdb # drop to PDB on first failure, then end test session py.test-3 --pdb --maxfail=3 # drop to PDB for the first three failures SETTING A BREAKPOINT
/ AKA SET_TRACE() If you want to set a breakpoint and enter the pdb.set_trace() you can use a helper: import pytest def test_function(): ... pytest.set_trace() # invoke PDB debugger and tracing In previous versions you could only enter PDB tracing if you disabled capturing on the command line via py.test-3 -s. PROFILING TEST EXECUTION DURATION
To get a list of the slowest 10 test durations: py.test-3 --durations=10 CREATING JUNITXML FORMAT FILES
To create result files which can be read by Hudson or other Continuous integration servers, use this invocation: py.test-3 --junitxml=path to create an XML file at path. CREATING RESULTLOG FORMAT FILES
To create plain-text machine-readable result files you can issue: py.test-3 --resultlog=path and look at the content at the path location. Such files are used e.g. by the PyPy-test web page to show test results over several revi- sions. SENDING TEST REPORT TO POCOO PASTEBIN SERVICE
Creating a URL for each test failure: py.test-3 --pastebin=failed This will submit test run information to a remote Paste service and provide a URL for each failure. You may select tests as usual or add for example -x if you only want to send one particular failure. Creating a URL for a whole test session log: py.test-3 --pastebin=all Currently only pasting to the http://paste.pocoo.org service is implemented. CALLING PY.TEST-3 FROM PYTHON CODE New in version 2.0. You can invoke py.test-3 from Python code directly: pytest.main() this acts as if you would call "py.test-3" from the command line. It will not raise SystemExit but return the exitcode instead. You can pass in options and arguments: pytest.main(['x', 'mytestdir']) or pass in a string: pytest.main("-x mytestdir") You can specify additional plugins to pytest.main: # content of myinvoke.py import pytest class MyPlugin: def pytest_addoption(self, parser): raise pytest.UsageError("hi from our plugin") pytest.main(plugins=[MyPlugin()]) Running it will exit quickly: $ python myinvoke.py ERROR: hi from our plugin AUTHOR
holger krekel at merlinux eu COPYRIGHT
2011, holger krekel et alii 2.2 June 24, 2012 PY.TEST-3(1)
All times are GMT -4. The time now is 07:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy