![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| perl/mail - inserting file text in message body | thumper | Shell Programming and Scripting | 2 | 01-28-2008 03:29 PM |
| replacing a nul field with text | DarkHound | Shell Programming and Scripting | 3 | 09-04-2007 03:34 PM |
| sh: Inserting tabs and moving text to 1 line | 00000008 | Shell Programming and Scripting | 6 | 07-26-2007 05:58 AM |
| yet another awk field syntax question | prkfriryce | Shell Programming and Scripting | 4 | 03-22-2007 01:13 PM |
| How to parse a text file with \034 as field and \035 as end of message delimiter? | indianya | Shell Programming and Scripting | 1 | 08-26-2005 10:20 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Question about sed. Inserting text in field?
Hi,
I have tried to develop a sed script that inserts date and time in the third field in the first and second row below. The third row is an example and it shows where the date and time should be inserted. The script should check if the row already has date and time in the third field and if it is missing it should insert date and time. 1 106 texttexttext texttextexttext 4 1023 texttext texttext texttext 9 1234 07-02-05 16:06:46:743 texttext textextext text Here is the script I have managed to develop so far. The script just insert date and time in the beginning of a line that miss the date and time and it will not be inserted in the third field. I would apreciate help to get date and time inserted correctly. sed '/[0-9][0-9]*[0-9]* [0-9][0-9]*[0-9]*[0-9]* [0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]:[0-9][0-9][0-9]/!s/^/07-02-05 16:06:46:743: &/g' / Richard |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|