January 4th, 2013, 03:09 PM
Unix Admin Awk/Sed script, need some help! =)
Good afternoon everyone! I work as a system administrator as a consultant. I help administrate a polling program for a number of stores.
I have a list of store numbers that's called by a script (4000+ store numbers), I need to comment out 300 store numbers from that list. Is there an easy script that could compare the two and comment out specific numbers while preserving the old list? They are not consecutive numbers either, and they must remain commented (not deleted).
Sorry if I posted this in the wrong section, I really appreciate any help
January 6th, 2013, 08:22 AM
Make a backup copy of the original file first, but being an admin you'd be doing that anyway. Right?
Is the list of store numbers to be commented out available in a handy file? If so, you should be able to throw together a quick awk script that parses the original file and, based on the return of a user function output the original line or the original line commented out. The user function would take the store number as a parameter and use that in a system() call to a grep command (use -c or -q options) for this number in the list of numbers to be commented out.
The moon on the one hand, the dawn on the other:
The moon is my sister, the dawn is my brother.
The moon on my left and the dawn on my right.
My brother, good morning: my sister, good night.
-- Hilaire Belloc