Sponsored Content
Top Forums Shell Programming and Scripting Hide status value from awk system command Post 302361187 by muruganksk on Monday 12th of October 2009 02:45:53 PM
Old 10-12-2009
Hi,
Thanks a lot for the valuable help..

The command that you gave last worked fine, but then the issue am facing now is i need to print some values before the execution of script.

This is what actually am trying for :

Code:
awk -F"|" '{print $1,$2,$3,system("echo" $4),$5,$6,system("convert.sh" $12 $13 $9 $10)}' input_file

when i was trying this command i was facing the issue with the exit status.

But then the command you provided replaced the system , but then i am not able to get the previous values printed.

Please advise..

---------- Post updated at 10:42 PM ---------- Previous update was at 10:23 PM ----------

Hi,
To make it more precise :

The input file content:

file name : input_file

Code:
2012                 | TEST | TEST1   |              14031 |      276500 |  TST2               |  334FAAA     |       124706 |       274506 |      2142767 |       346329 |  x'55'         |  x'4F'                 |            0 |       40 |        0

Code tried :

Code :

Code:
awk -F"|" '{print $1,$2,$3,system("echo" $4),$5,$6,system("convert.sh" $12 $13 $9 $10)}' input_file


Expected output :

Code:
2012 TEST TEST1 14031 276500 TST2 2012 TEST TEST1 14031 276500 TST2 v7126-6528-6230-6530-YOA1-274506-85-79-2142767

the last value v7126-6528-6230-6530-YOA1-274506-85-79-2142767 is the output from the convert.sh.

But the output that i currently get is :

Code:
2012 TEST TEST1 14031 
0 276500 TST2 v7126-6528-6230-6530-YOA1-274506-85-79-2142767
0

Thanks !

---------- Post updated 10-13-09 at 12:15 AM ---------- Previous update was 10-12-09 at 10:42 PM ----------

Can somebody help??

Last edited by Franklin52; 10-12-2009 at 02:15 PM.. Reason: Please use code tags!!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk system() command not working

I am using Sun Solaris 5.8 I am trying to run a system command such as ls and echo inside awk, but when I run the following code system echo is not displayed. bash-2.03$ ls | awk 'BEGIN { print "first print" system("echo system echo") print "second print" ... (1 Reply)
Discussion started by: rakeshou
1 Replies

2. Shell Programming and Scripting

system command within awk

I was trying commands within awk. i got stuck here. i take 2 files. cat input first second third fourth fifth sixth seventh eighth ninht tenthcat add *************** Nirbhay ***************i run the command awk '{ if ( NR == 5 ) { print system("cat add") "\n" $0 } else {... (4 Replies)
Discussion started by: nirbhay
4 Replies

3. UNIX for Advanced & Expert Users

How to hide command line parameters?

Hello I want to hide command line parameters of my programs/scripts to not to be seen with 'ps' command. How can I do that? thanks in advance. (6 Replies)
Discussion started by: xyzt
6 Replies

4. Cybersecurity

how to Hide Passwords From UNIX ps Command

Hi, By reporting the process status with ps, any Unix user will see the command line arguments #ps -ef UID PID PPID C STIME TTY TIME CMD lsc 13837 13825 0 May 11 pts/17 0:01 -ksh oracle 4698 6294 0 12:00:40 ? 0:00 sqlplus -s system/manager appluser 4229 4062 0 12:00:03... (2 Replies)
Discussion started by: bhagirathi
2 Replies

5. Shell Programming and Scripting

hide stdout but need exit status

Hi: echo "Escriba el nombre de usuario: \c" read user lsuser -a $user 2>/dev/null || (echo "Usuario no valido en el sistema. Abortando." && exit 1) I want: - If 'lsuser -a $user' fails, script exits but hide stderr. - If 'lsuser -a $user' succeeds, script continue, and hide stdout.... (10 Replies)
Discussion started by: iga3725
10 Replies

6. Shell Programming and Scripting

awk - System command not working

dear All, my awk system command isn't working or rather I'm missing something in my command. Appreciated , if anyone can assist me what exactly I'm missing ?? awk ' /^/ { > c=split($3,a,"/") ;for(n=1; n<=c; ++n) > { > if (system("test -d" /home/cubedata/20120104/"$1"/"a")) { > print... (5 Replies)
Discussion started by: manas_ranjan
5 Replies

7. Programming

How to hide from UNIX strings - obfuscate or hide a literal or constant?

Hi, I need to somehow pipe the password to a command and run some SQL, for example, something like echo $password | sqlplus -s system @query01.sql To make it not so obvious, I decided to try out writing a small C program that basically just do echo $password. So now I just do x9.out | sqlplus... (8 Replies)
Discussion started by: newbie_01
8 Replies

8. Ubuntu

Hide command details in top?

I am pulling data from remote SFTP server via LFTP. I really like its features. I have executed following command through screen. lftp -u xxxxx,xxxxx -e "set sftp:connect-program 'ssh -a -x -i /sftp/user/downloads/.ssh/id_dsa';mirror -vvv -c /data/ /sftp/user/downloads/2014_ic; quit"... (1 Reply)
Discussion started by: zsycho
1 Replies

9. Shell Programming and Scripting

Awk: System command not working in awk

Hi, I have around 10 files in a folder in which I want to change the file format from tab(\t) to pipe(|) with some changes in the fields as well. Below is the code, while tmp file is getting generated but move command is not working, please help Following is the code awk -F"\t" '{print... (2 Replies)
Discussion started by: siramitsharma
2 Replies

10. Shell Programming and Scripting

Using sprintf and system command in awk

Hello Friends, I'm trying something hard (for me) to create a report script,normally the following script works: Echos are just for cosmetic touch, echo -n "\n-----\t----------\t-------------\t\t--------------\t\t--------\n COUNT\tEVENT_TYPE\tRESPONSE_CODE\t\tINTERNAL_ERROR\t\tFLOWNAME... (7 Replies)
Discussion started by: EAGL€
7 Replies
IRSEND(1)								FSF								 IRSEND(1)

NAME
irsend - basic LIRC program to send infra-red commands SYNOPSIS
irsend [options] DIRECTIVE REMOTE CODE [CODE...] DESCRIPTION
Asks the lircd daemon to send one or more CIR (Consumer Infra-Red) commands. This is intended for remote control of electronic devices such as TV boxes, HiFi sets, etc. DIRECTIVE can be: SEND_ONCE - send CODE [CODE ...] once SEND_START - start repeating CODE SEND_STOP - stop repeating CODE LIST - list configured remote items SET_TRANSMITTERS - set transmitters NUM [NUM ...] SIMULATE - simulate IR event REMOTE is the name of a remote, as described in the lircd configuration file. CODE is the name of a remote control key of REMOTE, as it appears in the lircd configuration file. NUM is the transmitter number of the hardware device. For the LIST DIRECTIVE, REMOTE and/or CODE can be empty: LIST "" "" - list all configured remote names LIST REMOTE "" - list all codes of REMOTE LIST REMOTE CODE - list only CODE of REMOTE The SIMULATE command only works if it has been explicitly enabled in lircd. -h --help display usage summary -v --version display version -d --device use given lircd socket [/var/run/lirc/lircd] -a --address=host[:port] connect to lircd at this address -# --count=n send command n times EXAMPLES
irsend LIST DenonTuner "" irsend SEND_ONCE DenonTuner PROG-SCAN irsend SEND_ONCE OnkyoAmpli VOL-UP VOL-UP VOL-UP VOL-UP irsend SEND_START OnkyoAmpli VOL-DOWN ; sleep 3 irsend SEND_STOP OnkyoAmpli VOL-DOWN irsend SET_TRANSMITTERS 1 irsend SET_TRANSMITTERS 1 3 4 irsend SIMULATE "0000000000000476 00 OK TECHNISAT_ST3004S" FILES
/etc/lirc/lircd.conf Default lircd configuration file. It should contain all the remotes, their infra-red codes and the corresponding timing and wave- form details. DIAGNOSTICS
If lircd is not running (or /var/run/lirc/lircd lacks write permissions) irsend aborts with the following diagnostics: "irsend: could not connect to socket" "irsend: Connection refused" (or "Permission denied"). SEE ALSO
The documentation for lirc is maintained as html pages. They are located under html/ in the documentation directory. lircd(8), mode2(1), smode2(1), xmode2(1), irrecord(1), irw(1), http://www.lirc.org. irsend 0.8.7pre1 May 2010 IRSEND(1)
All times are GMT -4. The time now is 01:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy