I got a "working" script for monitoring Autosys jobs. Basically, it starts with listing all the jobs that are due to run in a "shift". Now, I'm in the part where I want to delete a job/word from a list BUT only the first occurrence of such job name. This is to consider jobs that runs multiple times.
Ex: I got a list of jobs in a file:
Is there any one-liner (awk, sed, etc.) that can delete the first occurrence only, e.g. JOB1, leaving the other - after JOB3 - in the list? Or other way to implement this?
I saw a sed one-liner but deletes all. By the way, the jobs listed is stored in a variable JOBNAME.
sed -ie "\|^$JOBNAME\$|d"
Please put some explanation. :) I really am a newbie to scripting but working hard to learn the way of the force.