Sponsored Content
Top Forums Shell Programming and Scripting Substitute grep command at run time Post 303022665 by asifansari on Wednesday 5th of September 2018 07:27:53 AM
Old 09-05-2018
I didn't get what you suggested..
Code:
alias PATTERN="${3:-grep whatever you want here}"

.....

COUNT=$(PATTERN|egrep "${start_tim}|${end_tim}" | awk ... etc etc ...)

While I need
Code:
COUNT=$(cat ${METRICS_FILE} | ${PATTERN} |egrep "${start_tim}|${end_tim}" |awk -F"Count=" '{print $2}'|cut -d',' -f1 |perl -lne '$sum += $_ } { print $sum')

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

substitute the grep output

I have a file name called fruits. In this file the prices keep on changing & the order in which fruits are listed keep on changing. $ cat fruits fruitname price/pound redapples 30 grapes 50 oranges 20 $echo $custom_price 35 What I want to do is that if the file "fruits" contains... (1 Reply)
Discussion started by: jasmeet100
1 Replies

2. UNIX for Dummies Questions & Answers

Run Command in Specific Time ...

Guy's I want to make script to run this command solevel every Saturday at 8:00 clock exactly . Can you please help me and teach me how to do this ... (9 Replies)
Discussion started by: IT Helper
9 Replies

3. Shell Programming and Scripting

Show date/time with tail|grep command

Hi, I have a log file without date/time, and I want that everytime tail|grep find something it displays the date/time and the line. I have tried something like this command but without any luck to display the date/time: tail -F catalina.out | sed "s/^/`date `/" | egrep ... (6 Replies)
Discussion started by: julugu
6 Replies

4. AIX

time of a particular command run

Hello all, I need to find, what time a particular command was run in one of our AIX box. In our environment, we use 'powerbroker' to login as root and there are so many people who use this. I tried history command, which shown me similar to below: 406 ls -l | *user* 407 ls -l... (1 Reply)
Discussion started by: gsabarinath
1 Replies

5. Ubuntu

run multiple command at the same time in one window terminal using multiplexer

Hi, I would like to ask if someone knows or accomplished this task in the terminal multiplexer in a single window with multiple splitted pane: In the script run multiple command at the same time in diff splitted pane or simulatneously. As an example: I would like to run iptraf, iotop, htop,... (2 Replies)
Discussion started by: jao_madn
2 Replies

6. Shell Programming and Scripting

Time taken to run grep in different OS

Hi , I am greping a keyword in all sql files in Solaris and Linux. Solaris bash-3.00$ time grep -iwc BEN_STARTUP_LERS_TL084701_WHO *.sql Load__v20130719-prod.sql:0 Load__v20130719-prod.sql:0 Load__v20130719-prod.sql:0 Load__v20130719-prod.sql:0 Load__v20130719-prod.sql:0... (4 Replies)
Discussion started by: millan
4 Replies

7. Shell Programming and Scripting

Using grep command to detect presence of script run

i have this line of code on a korn shell script to detect the presence of script run: ISRUNNING=`ps -eaf -o args | grep -i sfs_load_file.ksh | grep -v grep | wc -l` sometimes this returns either 1, 2, or 3. when it returns 2 or 3 that tells us that there are more than 1 script of... (8 Replies)
Discussion started by: wtolentino
8 Replies

8. Shell Programming and Scripting

Grep and substitute?

I have to parse ASCII files, output the relevant data to a comma-delimited file and load it into a database table. The specs for the file format have been recently updated and one section is causing problems. This is the original layout for that section. ... (2 Replies)
Discussion started by: alan
2 Replies

9. Shell Programming and Scripting

Run a command for specific amount of time with an auto key press

Hi, I have been trying to do a small fun project for myself. I want to run a command for 45 seconds. And to get the final output of this command, the script requires I push the "q" key on my keyboard and then the final output file becomes available. I tried the following script. But it... (12 Replies)
Discussion started by: jacobs.smith
12 Replies

10. Shell Programming and Scripting

Listen sharp time to run a command inside a script

Hello, Just wondered if there is any possibility to run a command at sharp time inside a script in linux. My question is not about crontab Example: #!/bin/bash cd /home/database for i in * do command 1 if time is 19:00, day is Monday then run command2 if time is 20:00, day is... (10 Replies)
Discussion started by: baris35
10 Replies
Locale::Codes::LangExt(3pm)				 Perl Programmers Reference Guide			       Locale::Codes::LangExt(3pm)

NAME
Locale::Codes::LangExt - standard codes for language extension identification SYNOPSIS
use Locale::Codes::LangExt; $lext = code2langext('acm'); # $lext gets 'Mesopotamian Arabic' $code = langext2code('Mesopotamian Arabic'); # $code gets 'acm' @codes = all_langext_codes(); @names = all_langext_names(); DESCRIPTION
The "Locale::Codes::LangExt" module provides access to standard codes used for identifying language extensions, such as those as defined in the IANA language registry. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default IANA language registry codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language extensions. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lext = code2langext('acm','alpha'); $lext = code2langext('acm',LOCALE_LANGEXT_ALPHA); The codesets currently supported are: alpha This is the set of three-letter (lowercase) codes from the IANA language registry, such as 'acm' for Mesopotamian Arabic. This is the default code set. ROUTINES
code2langext ( CODE [,CODESET] ) langext2code ( NAME [,CODESET] ) langext_code2code ( CODE ,CODESET ,CODESET2 ) all_langext_codes ( [CODESET] ) all_langext_names ( [CODESET] ) Locale::Codes::LangExt::rename_langext ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangExt::add_langext ( CODE ,NAME [,CODESET] ) Locale::Codes::LangExt::delete_langext ( CODE [,CODESET] ) Locale::Codes::LangExt::add_langext_alias ( NAME ,NEW_NAME ) Locale::Codes::LangExt::delete_langext_alias ( NAME ) Locale::Codes::LangExt::rename_langext_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangExt::add_langext_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangExt::delete_langext_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.iana.org/assignments/language-subtag-registry The IANA language subtag registry. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2012 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.2 2012-10-11 Locale::Codes::LangExt(3pm)
All times are GMT -4. The time now is 09:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy