I am doing a for loop and if a file name already exists I am appending the file contents to the file that already exists, for example a file contains:
Host,Time,% Inodes Used(/),% Inodes Used(/var),% Inodes Used(/opt),% Inodes Used(/opt/app),% Inodes Used(/export/home)
srv1,Wed Aug 17 06:00:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:05:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:10:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:15:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:20:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
and the next files contains:
Host,Time,% Inodes Used(/),% Inodes Used(/var),% Inodes Used(/opt),% Inodes Used(/opt/app),% Inodes Used(/export/home)
srv1,Wed Aug 19 06:00:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:05:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:10:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:15:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:20:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
so my files ends up like:
Host,Time,% Inodes Used(/),% Inodes Used(/var),% Inodes Used(/opt),% Inodes Used(/opt/app),% Inodes Used(/export/home)
srv1,Wed Aug 17 06:00:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:05:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:10:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:15:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:20:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
Host,Time,% Inodes Used(/),% Inodes Used(/var),% Inodes Used(/opt),% Inodes Used(/opt/app),% Inodes Used(/export/home)
srv1,Wed Aug 19 06:00:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:05:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:10:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:15:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:20:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
but what I want is:
Host,Time,% Inodes Used(/),% Inodes Used(/var),% Inodes Used(/opt),% Inodes Used(/opt/app),% Inodes Used(/export/home)
srv1,Wed Aug 17 06:00:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:05:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:10:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:15:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:20:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:00:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:05:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:10:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:15:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:20:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
How do I delete all lines that match "Host,Time,% Inodes Used(/),% Inodes Used(/var),% Inodes Used(/opt),% Inodes Used(/opt/app),% Inodes Used(/export/home)" EXCEPT the first line? I know how to delete all lines that match that with sed, but I want to keep the first line.
Thanks.
Host,Time,% Inodes Used(/),% Inodes Used(/var),% Inodes Used(/opt),% Inodes Used(/opt/app),% Inodes Used(/export/home)
srv1,Wed Aug 17 06:00:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:05:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:10:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:15:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:20:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
and the next files contains:
Host,Time,% Inodes Used(/),% Inodes Used(/var),% Inodes Used(/opt),% Inodes Used(/opt/app),% Inodes Used(/export/home)
srv1,Wed Aug 19 06:00:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:05:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:10:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:15:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:20:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
so my files ends up like:
Host,Time,% Inodes Used(/),% Inodes Used(/var),% Inodes Used(/opt),% Inodes Used(/opt/app),% Inodes Used(/export/home)
srv1,Wed Aug 17 06:00:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:05:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:10:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:15:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:20:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
Host,Time,% Inodes Used(/),% Inodes Used(/var),% Inodes Used(/opt),% Inodes Used(/opt/app),% Inodes Used(/export/home)
srv1,Wed Aug 19 06:00:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:05:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:10:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:15:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:20:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
but what I want is:
Host,Time,% Inodes Used(/),% Inodes Used(/var),% Inodes Used(/opt),% Inodes Used(/opt/app),% Inodes Used(/export/home)
srv1,Wed Aug 17 06:00:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:05:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:10:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:15:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 17 06:20:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:00:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:05:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:10:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:15:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
srv1,Wed Aug 19 06:20:04 CDT 2005,14.2,2.1,0.9,5.2,0.1
How do I delete all lines that match "Host,Time,% Inodes Used(/),% Inodes Used(/var),% Inodes Used(/opt),% Inodes Used(/opt/app),% Inodes Used(/export/home)" EXCEPT the first line? I know how to delete all lines that match that with sed, but I want to keep the first line.
Thanks.