截屏视频帮助
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

Looking for a generic script to search UNIX\Linux txt files for a string on SMP 7.1

创建时间: 14 11 月 2012 | 2 条评论

I was wondering if anyone had a generic UNIX\Linux script on SMP 7.2 Inventory Solution that they had already tested that would search for a specific file and then search for a specfic string returning either that line or the whole file (or some variation of this that's easily tweaked!)

评论 条评论跳转至最新评论

QuietLeni 的图片
 
Hmmm... I have written a number of Bash shellscripts to do things similar to this. You are asking for a tall order if you are looking for the WHOLE FILE and this would take a lot of time to write (I did this many years ago).
 
Getting a single line is much more reasonable and is reasonably simple to do.
 
However, I am not sure exactly what you want? what is your ideal scenario?
 
Kindest regards,
 
QuietLeni

What is the point of an Asset Management Solution that needs excessive management? Let me help you.

Thunder_Chicken 的图片

Thanks.

I didn't really mean the contents of the file just the filename and say, path.

It is just the 1 line I would be looking for.

So in the example of 'client.conf' I was looking for generic scripts that would search for the file first and where present

(1) Search for the string 'Server-1' and return that line if found or even simpler

(2) Search for the string 'Server-1=servername.domain.com and return a TRUE

e.g.
# This is the Altiris Server name agent is working with.
Server-1=servername.domain.com

#

Is this similar to the scripts you've written before ............?