I did not use UNIX for a long time, now i need to make a flat file with extra field, can you help me with the code ?
I create a last line of each log from each system and make it in a flat text file (seperate by a pipe |)
mv current.log old
tail -1 sanfrancisco.log > current.log
tail -1 oakland.log >> current.log
Current.log
2011/04/07 14:49:46 | 61:linux pid=027546 opened Boards 0, 1, 2, 3 for /home/goniners/abcd/
2011/04/08 08:13:39 | 255:linux pid=016870 opened Boards 0, 1, 2, 3, 4, 6 for /home/gosteelers/asdas/
How do we create new.log which have a hostname in a 2nd fields ?
2011/04/07 14:49:46 |sanfrancisco| 61:linux pid=027546 opened Boards 0, 1, 2, 3 for /home/goniners/abcd/
2011/04/08 08:13:39 |oakland| 255:linux pid=016870 opened Boards 0, 1, 2, 3, 4, 6 for /home/gosteelers/asdas/