Can someone help me outline a ksh script:
I want to be able to grep file X for Y and if its not exist i want it to write it Y out to another file; and then echo Y out
Where X is a list. ----------------- cat file1 1 2 3 4 5 -------------- so if i grep file1 for 6 it will put the number 6 in another file and echo out 6 does not exist |
It looks like an homework question, doesn't it? Take a look at the if/then construct using a command in place of a logical expression. The Advanced Bash Scripting Guide, Chapter 7.1 explains it all. No difference between bash and ksh for this issue!
|
Quote:
I'm actually in the middle of an install and i dont script frequently, so my knowledge doesnt stay fresh. I'm good, i spent some time on it after i wrote the question i had a list of packages on hpux, 251, that i needed to confirm were installed. Thx again |
Ok. You can try a test like this:
Code:
pattern=6 You can demonstrate it running the following: Code:
$ cat file1 |
If you are more familiar with PHP then with KSH, then make it a PHP script and launch it from the command-line, like '$ php myscript.php'.
I have found it more easier for my own work to switch to a scripting language that I use frequently instead of shell scripting that are a bit cumbersome anyway. Debian |
All times are GMT -5. The time now is 01:56 AM. |