Example:
`abc.ksh | grep '^GLIS'| awk -F' ' '{print \$1}'`;
Example:
`abc.ksh | grep '^GLIS'| awk -F' ' '{print \$1}'`;
Hello Tanu,
It's a kind request to be more clear into your questions, however could you please go through following and let us know if this helps you.
`abc.ksh ####Your script, not sure about it what it does and what output it gives. So it runs here.
| ####using pipe here so that above script's standard output, re-directing to next command as standard input.
grep '^GLIS' ####In abc.ksh's output using grep(to search strings) where any line is starting with string GLIS swarch all those lines.
| ####Again using pipe to send previous command's standard output to next command as standard input.
awk -F' ' '{print \$1}'`; ####Using awk here, where -F' ' defines the delimiter is space. Printing the first field here by using $1.
Also in above code there is no need for doing \$1
it should be good with $1
if you are not using it with commands like ssh
etc.
EDIT: Edited my explanation above where I mentioned line not starting, changed it to line starting now, I had a typo there. Thanks to greet_sed, corrected it now.
Thanks,
R. Singh
Thanks Ravinder. I thought single quotes (' ') had some issue in my command but it was \ (as you mentioned).
In perl script it works with \ (like \$1) only but in shell script no need of \ (simple $1).
Thanks again.
Hi Ravinder,
$ grep '^str' looks for a word call ed "str" in the beginning of a line .
May be it is just a typo in your post.