![]() |
|
|
|||||||
| Home | Forums | Register | Rules & FAQ | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. Shell Script Page. |
Other UNIX.COM Threads You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to handle multiple rows in a file | ksmbabu | Shell Programming and Scripting | 2 | 05-14-2008 09:44 PM |
| change the filename by adding up 1 each time, tricky one | netbanker | Shell Programming and Scripting | 5 | 03-07-2008 12:45 PM |
| rsh to change multiple ip in multiple servers? | kenshinhimura | Shell Programming and Scripting | 2 | 02-17-2008 11:04 PM |
| change multiple ownership | invinzin21 | Shell Programming and Scripting | 1 | 01-17-2008 06:51 AM |
| How to handle the Multiple Rows in the Database | hsekol | Shell Programming and Scripting | 2 | 03-05-2007 04:51 AM |
![]() |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Hi, I have an output file like:
1415971694 376 (12); 3434327831 376 (7); 2989082873 332 (3); 4075357577 332 (3); 1221064374 376 (2); 2372410470 376 (2); 2563564778 332 (2); 443221432 376 (1); 2478131897 376 (1); 2618850598 22 (1); 2559136519 376 (1); 1452300479 376 (1); 1915653342 376 (1); 2063345836 372 (1); I would like a new file like: a timestamp and each row adding up 2007-12-31:20:38:24: 1415971694 376 (12);3434327831 376 (7);2989082873 332 (3);.......1915653342 376 (1);2063345836 372 (1); Thank u for the help and Happy new year! |
| Forum Sponsor | ||
|
|
|
|||
|
Code:
# tr '\n' ' ' < file | xargs echo `date +%Y-%m-%d:%H:%M:%S` 2008-01-01:12:55:17 1415971694 376 (12); 3434327831 376 (7); 2989082873 332 (3); 4075357577 332 (3); 1221064374 376 (2); 2372410470 376 (2); 2563564778 332 (2); 443221432 376 (1); 2478131897 376 (1); 2618850598 22 (1); 2559136519 376 (1); 1452300479 376 (1); 1915653342 376 (1); 2063345836 372 (1); |