Sponsored Content
Top Forums Shell Programming and Scripting Substitute grep command at run time Post 303022666 by rovf on Wednesday 5th of September 2018 07:40:02 AM
Old 09-05-2018
Once more:

- Since interpolation of the variable does not work, as I explained, I suggested that you model your "pattern" not by a variable named PATTERN, but by an alias named PATTERN.

- Also note that in my proposal, I suggested to drop the unnecessary cat command and replaced the depecated backquotes for process substitution, which you had used, by $(....). These changes don't affect the functionality, though.
This User Gave Thanks to rovf For This Post:
 

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
RREP(1) 						      General Commands Manual							   RREP(1)

NAME
rrep - replace patterns in files. SYNOPSIS
rrep [OPTIONS] PATTERN REPLACEMENT [FILE...] DESCRIPTION
The rrep utility searches input FILEs for matches to a given PATTERN and replaces those matches by a given REPLACEMENT. The pattern is, by default, a basic regular expression. The replacement string may contain special characters to refer to portions of the matched pattern. Binary files are, by default, ignored. A file is regarded as binary if it contains the null character. OPTIONS
-E, --extended-regexp PATTERN is interpreted as an extended regular expression (ERE). -F, --fixed-strings PATTERN and REPLACEMENT are interpreted as fixed strings, not as regular expressions or escape sequences. -R, -r, --recursive Each directory that is given on the command line is processed recursively. Files and sub-directories starting with the . character are, by default, ignored. --include=FILE_PATTERN Only files are processed that match the pattern FILE_PATTERN, except for files that are specifically given on the command line. *, ?, and [...] can be used as wildcards in FILE_PATTERN. Wildcards and backslash characters can be quoted with . --exclude=FILE_PATTERN Files that match the pattern FILE_PATTERN will be skipped, except for files that are specifically given on the command line (using wildcard matching as described under --include). --exclude-dir=PATTERN Directories that match PATTERN will be skipped, except for files that are specifically given on the command line (using wildcard matching as described under --include). -V, --version Print the version number of rrep. -S SUFFIX, --suffix=SUFFIX Override default backup suffix. This option implicitly activates backups. -a, --all Files and sub-directories starting with the . character in recursively processed directories (see --recursive) are processed as well. -b Backup before overwriting files. The backup files are written into the directory of the original file. Equivalent to using --backup=existing. --backup[=CONTROL] Like -b but accepts a version control argument. The file name of the backup file is appended by a ~ character. The backup suffix is ~, unless set with --suffix or SIMPLE_BACKUP_SUFFIX. The version control method may be selected via the --backup option or through the VERSION_CONTROL environment variable. Here are the values: none, off never make backups (even if --backup is given) numbered, t make numbered backups existing, nil numbered if numbered backups exist, simple otherwise simple, never always make simple backups --binary Do not ignore binary files. A file is regarded as binary if it contains the null character . --dry-run The replacement is just simulated. No file is actually modified. -e PATTERN, --regexp=PATTERN Use PATTERN for matching. This option can be used to specify a pattern beginning with -. -h, --help Display a help message that descibes the command line options and exit afterwards. -i, --ignore-case Case distinctions in PATTERN are ignored. --keep-times The original access and modification times of files and directories are restored after processing. -p REPLACEMENT, --replace-with=REPLACEMENT Use REPLACEMENT for substitution. --interactive Each time before a file is modified the user is prompted and can cancel the modification. -q, --quiet, --silent All normal output messages are suppressed. -s, --no-messages All error messages are suppressed. -w, --word-regexp Only those matches of PATTERN are replaced that match whole words. -x, --line-regexp Only those matches of PATTERN are replaced that match whole lines. EXIT STATUS
Exit status is 1 if any error occurs, 0 otherwise. AUTHOR
Written by Arno Onken. REPORTING BUGS
If you find a bug in rrep, please send electronic mail to <asnelt@asnelt.org>. Include the version number, which you can find by running rrep --version. Also include in your message the output that the program produced and the output you expected. If you have other questions, comments or suggestions about rrep, contact the author via electronic mail to <asnelt@asnelt.org>. The author will try to help you out, although he may not have time to fix your problems. COPYRIGHT
Copyright 2011 Arno Onken This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. SEE ALSO
Regular Manual Pages find(1), grep(1), sed(1), xargs(1), regex(7). TeXinfo Documentation The full documentation for rrep is maintained as a TeXinfo manual. If the info and rrep programs are properly installed at your site, the command info rrep should give you access to the complete manual. User Commands rrep 1.3.3 RREP(1)
All times are GMT -4. The time now is 03:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy