The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 03-12-2008
vvaidyan vvaidyan is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 15
Thanks Keelba, from your program, I got it into one liner:

(echo "1.txt";echo "2.txt") | xargs zgrep -n STRING | awk -F: '{printf "%s %s", $1" -", $2 "\n"}'

Later:

xargs zgrep -n STRING | awk -F: '{printf "%s %s", $1" -", $2 "\n"}'

I placed the above line in a file: vv-grep


Then, I can run this script neatly as:

(echo "1.txt";echo "2.txt") | ./vv-grep


The final thing which I want to enhance here is only for the input string to be searched for, so that the program can be executed like:

(echo "1.txt";echo "2.txt") | ./vv-grep STRING


I am trying to find out how I can get input in command line parameter to the script.


Thanks for the great help. I was able to understand your suggestion and could mould it in the way I wanted.

It will be great if you could tell me if you know as how to get the input from comand line parameter to the script.

vvaidyan