Sponsored Content
Top Forums Shell Programming and Scripting How can I pass arguments to system command in a awk script? Post 302884796 by Akshay Hegde on Wednesday 22nd of January 2014 12:57:36 AM
Old 01-22-2014
Quote:
Originally Posted by solaris21
Hi

I apreciate your helping, I only want to ask another question, please

Code:
byte=substr(cadena,pos,2);
cmd = "grep -n  "byte"  mapeo.txt"
system(cmd);

if I want to take the output of command system on a variable; Is it that possible? ...I try using

Code:
cmd = "grep "byte"  mapeo.txt | awk '{"ascii_dec"=$2}'"

however I had that:

Code:
awk: línea ord.:1: {=$2}
awk: línea ord.:1:  ^ syntax error

Thank you Smilie
in following thread there is one function named Cmd copy and paste in your program and then execute your system commands

Help me in the Execution of Date comparsion by Akshay Hegde - UNIX for Dummies Questions & Answers - Unix Linux Forums

Cheers..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

can I pass awk variable to system command?

I wanna use a system function to deal with several data. So I use awk variable FILENAME to transfer the file directory to system command, but it does not work. I use a shell function "out_function" to deal with data and save the result in another directory with the same file name. How can I... (2 Replies)
Discussion started by: zhynxn
2 Replies

2. Shell Programming and Scripting

need help to pass arguments in script

Hi, I have a my script here-- print "The Perl Script does the User health check and system health check...\n"; print "---------------------------------------------------------------------\n"; # use strict; my($OS); $OS = $^O; # need to test @ARGV before GetOptions shifts it if (@ARGV... (1 Reply)
Discussion started by: namishtiwari
1 Replies

3. Shell Programming and Scripting

How do we pass multiple arguments into awk

How do we pass multiple arguments into awk : name=john age=12 now i have to pass both age and name into awk.. how to do it? like : awk -v var=... (4 Replies)
Discussion started by: abhinav192
4 Replies

4. Shell Programming and Scripting

Pass command line arguments to awk

I am trying to pass max as a sommand line argument when I call awk. Made the modification in the BEGIN but it is not working I'm getting an error as below: awk: txsrx.awk:82: (FILENAME=jcd.tx FNR=4161) fatal: cannot open file `40' for reading (No such file or directory) Somehow it... (2 Replies)
Discussion started by: kristinu
2 Replies

5. Shell Programming and Scripting

How can i pass 2 command line arguments with a range between them

Hi, I am writting a script. i am not sure what i am trying to do is possible or not. thats why asking the best of the best. the script i want to write will recieve as input parameters 2 different options. as in MODE 1 -- start_date / end_date (2 dates has 2 go at a time MODE 2... (2 Replies)
Discussion started by: dazdseg
2 Replies

6. Programming

How to pass the command line arguments to the shell script in c language?

hi, I am new in the shell script, and c programming with linux. I am looking to pass the arguments in c program that should be executed by the shell script. e.g. #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv) { int i; for (i=1;i<argc; i++) { ... (2 Replies)
Discussion started by: sharlin
2 Replies

7. Post Here to Contact Site Administrators and Moderators

Unable to pass shell script parameter value to awk command in side the same script

Variable I have in my shell script diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff | awk -F'~' ''$2 == "$id"' {print $0}' > $new I could see value of $id is not passing to the awk... (0 Replies)
Discussion started by: Ashunayak
0 Replies

8. Shell Programming and Scripting

Need to pass shell arguments into Nawk/awk

Hi, I am in critical need of help, Thanks a ton for your help. I need to know how to pass the shell argument into nawk code in AIX. so that my file gets passed into that awk script and it can execute it part. To be detail, i have more than 100 files and in those files a particular field... (6 Replies)
Discussion started by: Selva_2507
6 Replies

9. Shell Programming and Scripting

How to pass command line arguments to awk program?

#!/bin/awk -f BEGIN { FS=":"; } { if ( $7 == "" ) { print $1 ": no password!"; } } I want to execute this program for a particular user to check for his password from the file /etc/passwd (as the input file) and the user details to be given... (1 Reply)
Discussion started by: sri.phani
1 Replies

10. Shell Programming and Scripting

Pass Arguments to Command from Shell Script

Hi all, I am working on a project, in which I have to connect to Bluetooth low energy device. I am able to connect and do data transfer from command line. But I want to do from script Here is my script #!/bin/bash #sudo hcitool -i hci0 lescan sleep 1 sudo hcitool -i hci0 lecc --random... (8 Replies)
Discussion started by: nithin@embdes
8 Replies
IRDADUMP(8)															       IRDADUMP(8)

NAME
irdadump - monitors the IrDA traffic on one or more links. SYNOPSIS
irdadump [ -b ] [ -c n ] [ -d ] [ -x ] [ -s n ] [ -t ] [ -l ] [ -v ] [ -i device ] OPTIONS
-b dump bytes in columns -c n set snapcols for byte printing with -b option -d prints the time difference between the current and the previous frame -x dump frame (bytes and ascii) -s n set snaplen for -b and -x option -t force TTP decoding of unknown connections -l set line buffering on output file -v verbose -i device interface DESCRIPTION
irdadump is a tool for monitoring the IrDA traffic on one or more links. Just write "make" to compile the program. When you run the pro- gram, you should be able to see the IrDA traffic (if any). One advantage of implementing IrDA device drivers as network device drivers is that you should be able to attach sniffers to the device (or actually the packet type). That way, it is possible to use a really handy utility called irdadump (instead of tcpdump). This will make debugging MUCH easier. Linux-2.2 implements the BPF (Berkeley Packet Filter), so its possible to filter out exactly the frames you want to see. You may use hostname to separate different machines names. Or grep to filter the output, too. irdadump must be run as root or installed setuid root, as it requires root privileges. EXAMPLES
The output should look something like this: / # ./irdadump 20:11:45.412199 xid:cmd 0x0015c23b > 0xffffffff S=6 s=0 20:11:45.492137 xid:cmd 0x0015c23b > 0xffffffff S=6 s=1 20:11:45.572137 xid:cmd 0x0015c23b > 0xffffffff S=6 s=2 20:11:45.652208 xid:cmd 0x0015c23b > 0xffffffff S=6 s=3 20:11:45.732137 xid:cmd 0x0015c23b > 0xffffffff S=6 s=4 20:11:45.812137 xid:cmd 0x0015c23b > 0xffffffff S=6 s=5 20:11:45.892175 xid:cmd 0x0015c23b > 0xffffffff S=6 s=255 Linux 20:11:45.902362 xid:rsp 0xf7be8388 < 0x0015c23b S=6 s=5 ACTiSYS IR100M 20:11:48.412197 xid:cmd 0x0015c23b > 0xffffffff S=6 s=0 20:11:48.492656 xid:cmd 0x0015c23b > 0xffffffff S=6 s=1 20:11:48.572177 xid:cmd 0x0015c23b > 0xffffffff S=6 s=2 20:11:48.652169 xid:cmd 0x0015c23b > 0xffffffff S=6 s=3 20:11:48.732177 xid:cmd 0x0015c23b > 0xffffffff S=6 s=4 20:11:48.812153 xid:cmd 0x0015c23b > 0xffffffff S=6 s=5 20:11:48.822371 xid:rsp 0xf7be8388 < 0x0015c23b S=6 s=4 ACTiSYS IR100M 15 packets received by filter Turning on the "-d" option will make irdadump print the time difference between the current and the previous frame: / # ./irdadump -d 20:11:18.412475 (0982.06 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=0 20:11:18.492345 (0079.87 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=1 20:11:18.572376 (0080.03 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=2 20:11:18.652979 (0080.60 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=3 20:11:18.732354 (0079.38 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=4 20:11:18.755093 (0022.74 ms) xid:rsp 0xf7be8388 < 0x0015c23b S=6 s=3 ACTiSYS IR100M 20:11:18.812350 (0057.26 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=5 20:11:18.892518 (0080.17 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=255 Linux 20:11:21.412486 (2519.97 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=0 20:11:21.492395 (0079.91 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=1 20:11:21.572368 (0079.97 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=2 20:11:21.652405 (0080.04 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=3 20:11:21.732458 (0080.05 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=4 irdadump must be run as root or installed setuid root, as it requires root privileges. irdadump -d -x -s 256 will check the contents of the frames. This should tell us if the frames have malformed content, or if the irda stack is doing something wrong. DIAGNOSTICS
N.N. BUGS
N.N. SEE ALSO
irattach(8), irdaping(8), irdadump(8), findchip(8), irpsion5(8), modprobe(8) Linux/IrDA Project http://irda.sourceforge.net -*- Linux/IrDA-Tutorial http://www.hpl.hp.com/personal/Jean_Tourrilhes/IrDA/index.html -*- Infrared-HOWTO http://tuxmobil.org/howtos.html AUTHOR
This manual page is written by Werner Heuser <wehe@tuxmobil.org>. It is based on the READMEs from irda-utils by the Linux/IrDA Project and the Linux/IrDA-Tutorial. COPYRIGHT
Copyright (c) 2001 Werner Heuser Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License (GFDL), Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. 03 July 2006 IRDADUMP(8)
All times are GMT -4. The time now is 09:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy