Hi RudiC,
I don't think so. I think ddirc wants entire lines from target_file for lines in target_file that contain one of the strings in input_file (presumably as a complete word; not just as a substring of a word) AND for any lines in input_file that were not found in target_file, ddirc wants those line from input_file to be printed as well.
Quote:
Originally Posted by MasWag
I am not sure the format of your files but the script will be like this. If the input_file is large, using AWK instead of while-loop may make sense.
There is no need to start an extra process nor to create a pipeline for this. It can be done more efficiently with just:
But, as mentioned above, it isn't clear to me that this is sufficient. If a line in input_file is:
that grep will match the following lines in target_file:
Hi ddirc,
You said the code MasWag suggested is working for you. Do you want lines like those in the above example to be matched? If not, please give us sample input and a clear description of any field delimiters that can be used to find the boundaries between the start and end of an IP address in target_file and please also show us the corresponding sample output you hope to produce.
Also, knowing what operating system and shell you're using always helps us give you suggestions that will stand a better chance of working in your environment.
This User Gave Thanks to Don Cragun For This Post:
Hi,
I found script which compare ciphers with openssl and return back all result in "YES" (for matching) and "NO" (for no match)
I want to result only "YES" part which can be achieved using grep but not sure how and where to place in below script"
Script:... (1 Reply)
Hi,
New to scripting and looking for some help.
I am trying to write a script that will search a specified directory for any new or modified files within the last 7 days and display the results. This will be ran daily and emailed?
Thanks (18 Replies)
I need a script to process the (space-separate) values for each line as seen in the below input file and then output the data into an output file as follows. We have been unable to create this using typical bash scripting and cold not find anything out on the internet similar to what we are trying... (3 Replies)
i have this line of code that looks for the same file if it is currently running and returns the count.
`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l`
basically it is assigned to a variable
ISRUNNING=`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh |... (6 Replies)
Hello,
I have a command and would like to make that as a script. How do I do that?
my command is:
grep -Eo +\.+\.+\.+.
and i want to have that like grepscript.sh x.txt > IP.txt
Can somebody help me? (3 Replies)
Hi
i wrote script use it as watchdog ( i mean it check another program (pooya) whenever that was killed (closed or crashed) it run another script (pooya_start.sh) to start it,
this script work fine and do the job for me , i need help of an expert to tell me (exact command) how to change this... (8 Replies)
Hi,
I need a script that will generate a set of random strings in sequence, with the ability to predetermine the length, quantity, and alphabet of individual string, and to use the outputs of earlier strings in the sequence to define the parameters of later strings. For examples, I might want... (5 Replies)
I need help in the following script. I want to grep the sql errors insert into the error table and exit the shell script if there is any error, otherwise keep running the scripts.
Here is my script
#!/bin/csh -f
source .orapass
set user = $USER
set pass = $PASS
cd /opt/data/scripts
echo... (2 Replies)
Hi.
I am trying to extract the output of the first few lines of a continuos sh script.
The when i run it, i wont to grep the the first 20 lines of it for an entry and basically do a crtl z out of it or to that effect, and output the results to a text file.
I basically want to script... (5 Replies)
hi guys,
i was hoping you could help me out with the following
im designing a help site for my work colleagues and would like a little script which would do a grep to check if an application is running on unix
for example this is what i do on unix
ps -ef | grep mqm
and this tells me if... (4 Replies)