Firstly, looks like the end of perl command is missing curly bracers in the end.
You should specify your operating system and shell used.
I cannot replicate behavior you are experiencing neither working or non working example on debian linux, using bash shell.
As for code, well i'm sure it could be written better, if you provide the relevant data to parse, and script expected input/output.
A PATTERN should be a string to match not a grep pipe grep command(s) inside a shell variable.
This is just wrong on so many levels and will not work as you expect or at all.
So my suggestion would be a complete rewrite
Also, for instance, you can specify a default value using shell builtin.
Meaning if $1 is not inputted or defined, it will be Gx otherwise it will be what is inputted/defined.
In Posix shell, bash, ksh and zsh, splitting the command line into the individual commands, takes place before parameter expansion. Hence, the shell doesn't see the pipe inside your pattern.
BTW, with this type of questions, you should always state which shell you are using.
Thanks for the prompt reply..
As stated the script is working fine if I do not give 3rd argument, this means the syntax which you are pointing is not correct, is not the case.
Here is the complete code:
Sample Input File: Paste the contents in m.csv.
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)