I'm afraid the title you selected is more than misleading. We're not discussing grep but shell functionality (see below).
There are two steps you can do to elicit how it works from a (compound , complex) command line:
- set the -x (--xtrace) option (or its equivalent) of your shell and execute again. The shell will unveil a lot (not all, alas) of what it does with the parts of the command(s).
- isolate single commands and execute by themselves, like
So this would result in a command
, from which output the lines containing "ERROR" are removed by an "inverted match" when piped through grep -v. Then, the second | delimited field is cut out, and in those, any single leading zero is substituted in the final sed.
Be aware that
a) the "backtick command substitution" `...` is deprecated and outdated and should be replaced by the modern form $(...)-
b) the parameters (not only) to the grep command should be double quoted to avoid problems should the "command substitution" 's result contain spaces et al.
Hi ,
I've written the following code to zip the big file
$dir_temp ="/home/etc/hst
zip -r $dir_temp/file_nm.zip $dir_temp/file_nm
The zip file has been created . When I try to UNZIP the file
with the following command
unzip file_nm.zip
The file got unzipped but created in the... (3 Replies)
Hi everyone, today i need that someone help to understand this particular line of command.
So you can explain to me step by step, it will be great.
---------- Post updated at 11:53 AM ---------- Previous update was at 11:51 AM ---------- (9 Replies)
I'm a Bash Newbie, hope you guys can help.
n.n
Ok, So I need to make a script that will get a list of the Users that are/have logged in (recently).
I've been wondering how to get it with either the last or the who command.
This Poses a problem, as with who, it ONLY shows the Users... (3 Replies)
Hi,
I am trying to emulate the '|' functionality through pipe function call. I am passing the o/p of exec in parent as input to the exec in child. The buf is readin the o/p but the exec in child is not working. Can somebody checkout the code and point where am i going wrong or missing something.... (3 Replies)
i want to search in the current directory all the files that contain one word for example "hello"
i want to achieve it with the grep command but not with the grep * (2 Replies)
i have a function defined in one ksh
i want to use the same functionality in another ksh
i am using
. ../<ksh name>
but it is not picking that functionality
what i have to do for the same (2 Replies)
I am doing "ps -f" to see my process.
but I get lines that one of it represents the ps command itself.
I want to grep it out using -v flag, but than I get another process that belongs to the GREP itself :
I would like to exclude
# ps -f
UID PID PPID C STIME TTY TIME CMD... (2 Replies)
Hello,
I am trying to write a script that has a option of restarting the script from where it failed. I have to write a script called Batch.sh. This script has to run quite a few sql files as shown below:
logcmd.sh -f test1.sql
logcmd.sh -f test2.sql
logcmd.sh -f test3.sql
logcmd.sh -f... (4 Replies)
I have a few xml files and I want to input say 5 parameters within each file. is it possible to do so with sed?
<parameter>A</parameter>
<parameter>B</parameter>
....
....
And so on.
These parameters are meant to go in just inside:
<?xml... (2 Replies)
Hi,
Could someone help me to get yesterday's date in MMDDYY format.
echo `date '+%m%d%y'`
is giving me today's date in the above format.
Thanks in advance for your help..
Suresh. (1 Reply)