Sponsored Content
Top Forums Shell Programming and Scripting Combining awk command to make it more efficient Post 302982432 by SkySmart on Thursday 29th of September 2016 02:10:10 AM
Old 09-29-2016
Combining awk command to make it more efficient

Code:
VARIABLE="jhovan    5259  5241  0 20:11 ?        00:00:00 /proc/self/exe --type=gpu-process --channel=5182.0.1597089149 --supports-dual-gpus=false --gpu-driver-bug-workarounds=2,45,57 --disable-accelerated-video-decode --gpu-vendor-id=0x80ee --gpu-device-id=0xbeef --gpu-driver-vendor --gpu-driver-version --v8-natives-passed-by-fd --v8-snapshot-passed-by-fd"

current command i'm using:

Code:
echo "${VARIABLE}" | awk '/channel=5182/ && !/egrep|ps -ef|grep / && ($0 ~ /1597/) {print $0}' | awk -F"1597089149" '{print $2}' | awk '{print $1}'

How can i optimize this code? i'd like to do everything with one awk command? possibly even avoiding the "echo".

the expected output should be:

Code:
--supports-dual-gpus=false

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Efficient way of Awk

Hi, Can someone let me know if the below AWK can be made much simpler / efficient ? I have 200 fields, I need to substr only the last fields. So i'm printing awk -F~ 'print {$1, $2, $3....................................$196,$197 , susbstr($198,1,3999), substr($199,1,3999)..}' Is there a... (4 Replies)
Discussion started by: braindrain
4 Replies

2. Shell Programming and Scripting

Is there a way to make this more efficient

I have the following code. printf "Test Message Report" > report.txt while read line do msgid=$(printf "%n" "$line" | cut -c1-6000| sed -e 's///g' -e 's|.*ex:Msg\(.*\)ex:Msg.*|\1|') putdate=$(printf "%n" "$line" | cut -c1-6000| sed -e 's///g' -e 's|.*PutDate\(.*\)PutTime.*|\1|')... (9 Replies)
Discussion started by: gugs
9 Replies

3. UNIX for Advanced & Expert Users

Which cut command is more efficient?

Hi, I've got a query regarding which of the following is more efficient & why - cat <filename>|cut -d'*' -f2- > <newfilename> or cut -d'*' -f2- <filename> > <newfilename> Thanks. (17 Replies)
Discussion started by: sumoka
17 Replies

4. Emergency UNIX and Linux Support

Help to make awk script more efficient for large files

Hello, Error awk: Internal software error in the tostring function on TS1101?05044400?.0085498227?0?.0011041461?.0034752266?.00397045?0?0?0?0?0?0?11/02/10?09/23/10???10?no??0??no?sct_det3_10_20110516_143936.txt What it is It is a unix shell script that contains an awk program as well as... (4 Replies)
Discussion started by: script_op2a
4 Replies

5. Programming

Help with make this Fortran code more efficient (in HPC manner)

Hi there, I had run into some fortran code to modify. Obviously, it was written without thinking of high performance computing and not parallelized... Now I would like to make the code "on track" and parallel. After a whole afternoon thinking, I still cannot find where to start. Can any one... (3 Replies)
Discussion started by: P_E_M_Lee
3 Replies

6. Shell Programming and Scripting

Combining awk printf and print strftime command

I have a lines like below, captured from rrdtool fetch command, 1395295200 2.0629986254e+06 7.4634784967e+05 1395297000 2.0198121616e+06 6.8658888903e+05 1395298800 1.8787141122e+06 6.7482866452e+05 1395300600 1.7586118678e+06 6.7867977653e+05 1395302400 1.8222762151e+06 7.1301678859e+05I'm... (3 Replies)
Discussion started by: rk4k
3 Replies

7. Shell Programming and Scripting

More efficient awk parser

I have an awk parser, that works great if the data is NC_0000 (four digits), but if it is not that then the data is parsed. I'm not sure the most efficient way to obtain the desired output. Thank you :). Code: awk 'FNR > 1 && match($0, /NC_0000(*)\..*g\.(+)(.)>(.)/, a){ print a, a, a, a, a }'... (14 Replies)
Discussion started by: cmccabe
14 Replies

8. Shell Programming and Scripting

How to make awk command faster?

I have the below command which is referring a large file and it is taking 3 hours to run. Can something be done to make this command faster. awk -F ',' '{OFS=","}{ if ($13 == "9999") print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12 }' ${NLAP_TEMP}/hist1.out|sort -T ${NLAP_TEMP} |uniq>... (13 Replies)
Discussion started by: Peu Mukherjee
13 Replies

9. Shell Programming and Scripting

How to make awk command faster for large amount of data?

I have nginx web server logs with all requests that were made and I'm filtering them by date and time. Each line has the following structure: 127.0.0.1 - xyz.com GET 123.ts HTTP/1.1 (200) 0.000 s 3182 CoreMedia/1.0.0.15F79 (iPhone; U; CPU OS 11_4 like Mac OS X; pt_br) These text files are... (21 Replies)
Discussion started by: brenoasrm
21 Replies
Tcl_CreateCloseHandler(3)				      Tcl Library Procedures					 Tcl_CreateCloseHandler(3)

__________________________________________________________________________________________________________________________________________________

NAME
Tcl_CreateCloseHandler, Tcl_DeleteCloseHandler - arrange for callbacks when channels are closed SYNOPSIS
#include <tcl.h> void Tcl_CreateCloseHandler(channel, proc, clientData) void Tcl_DeleteCloseHandler(channel, proc, clientData) ARGUMENTS
Tcl_Channel channel (in) The channel for which to create or delete a close callback. Tcl_CloseProc *proc (in) The procedure to call as the callback. ClientData clientData (in) Arbitrary one-word value to pass to proc. _________________________________________________________________ DESCRIPTION
Tcl_CreateCloseHandler arranges for proc to be called when channel is closed with Tcl_Close or Tcl_UnregisterChannel, or using the Tcl close command. Proc should match the following prototype: typedef void Tcl_CloseProc( ClientData clientData); The clientData is the same as the value provided in the call to Tcl_CreateCloseHandler. Tcl_DeleteCloseHandler removes a close callback for channel. The proc and clientData identify which close callback to remove; Tcl_Delete- CloseHandler does nothing if its proc and clientData arguments do not match the proc and clientData for a close handler for channel. SEE ALSO
close(n), Tcl_Close(3), Tcl_UnregisterChannel(3) KEYWORDS
callback, channel closing Tcl 7.5 Tcl_CreateCloseHandler(3)
All times are GMT -4. The time now is 01:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy